What happens in the following code? (you can start by running it and looking at the memory; note that you will need the –no_end flag)
func main():
[fp + 1] = 2; ap++
[fp] = 5201798304953761792; ap++
jmp rel -1
end
Starknet Developer Advocate @ StarkWare
What happens in the following code? (you can start by running it and looking at the memory; note that you will need the –no_end flag)
func main():
[fp + 1] = 2; ap++
[fp] = 5201798304953761792; ap++
jmp rel -1
end
Edit the loop my_loop in the exercise below so that it starts by writing 10 to [ap], continues by writing the decreasing sequence and then returns. Don’t forget the ret instruction. Verify that your code works as expected by looking at the memory.
func main():
[ap] = 2; ap++
my_loop:
[ap] = [ap - 1] * [ap - 1]; ap++
[ap] = [ap - 1] + 1; ap++
jmp my_loop
end
What does the following code do? (run with –no_end –step=16 to avoid the End of program was not reached error)
func main():
[ap] = 2; ap++
my_loop:
[ap] = [ap - 1] * [ap - 1]; ap++
[ap] = [ap - 1] + 1; ap++
jmp my_loop
end