How to access/ change a parameter inside loop?

As variables are local inside while/ for loop in Julia, I was wondering how to see the changes that happen inside loop and then use the values after changes??

For example, consider a very simple implementation of raising five to the power of three:

I did try this:

x1 = 5; n1 = 3; global result = 1;

for i in range(1,n1)
	result = result* x1

It will show the value of “1” for result. And once using global result = result* x1 inside for loop, it will return Multiple definitions for result.

Why is this? And how to save changes?

Your code works on my pc: result is 125

Really!! How come?? Did I do something wrong?

@qwerty this is what I get:


could this be a bug of Pluto? because now that I did the same inside repl it does return 125!


Yes, thaks @qwerty . with begin and end it gives the correct one.
But, isn’t it strange why in separate cell it’s not correct?