alice-teacher Change variable value on the fly

Don Slater dslater at andrew.cmu.edu
Wed Oct 30 13:13:46 EDT 2013


Rex,
The localProperty Boolean variable that you have declared inside of the while loop is local to the while loop, and not connected at all to the localProperty variable you declared before the while loop. This is a scoping issue of Java, not an Alice quirk.

See video at this link to which will show you how to use the assignment control tile of Alice to set the value of the original localProperty to false. 

	https://dl.dropboxusercontent.com/u/2332970/VariableScopeProblem.mp4

Let me know if you have another questions…

Later,
Don Slater
On Oct 30, 2013, at 10:00 AM, Rex McKanry <rmckanry at stchas.edu> wrote:

> Hi,
>  
> In Alice 3 I have created at variable at the top of the code screen. It is currently set to True and at some point in the code I would like to set it to False. It is a local variable and not a scene variable. I tried to make a copy of the variable and change it to False in a While loop but it does not end my loop. The code below is with a local variable but if I use a Scene variable and it seems to work and exit the while loop.
>  
> What am I doing wrong?
>  
> Thanks,
> Rex McKanry
> St Charles Community College
>  
> <AliceVariable.PNG>
> 
>  
> _______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20131030/9124549c/attachment.html 


More information about the alice-teachers mailing list