alice-teacher Change variable value on the fly

Rex McKanry rmckanry at stchas.edu
Wed Oct 30 13:43:32 EDT 2013


That's what I thought. I was missing how to make the variable value change one the variable with created.

Thanks for the help,
Rex
________________________________
From: alice-teachers-bounces+rmckanry=stchas.edu at lists.andrew.cmu.edu <alice-teachers-bounces+rmckanry=stchas.edu at lists.andrew.cmu.edu> on behalf of Don Slater <dslater at andrew.cmu.edu>
Sent: Wednesday, October 30, 2013 12:13 PM
To: Alice educators
Subject: Re: alice-teacher Change variable value on the fly

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<mailto: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<mailto: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/2159012d/attachment.html 


More information about the alice-teachers mailing list