<div dir="ltr">Try the same thing, but exclude the local variable declarations from your selection.<div>.</div><div>.</div><div>The reason for the different behaviour is that within the Workspace you don't actually have declare your variables.</div><div><br></div><div>If you don't declare variables within the scope of the selection, then they are stored in the scope of Workspace and you use them after your code completes.</div><div>If you do declare variables within the scope fo the selection, then they are stored within the scope selection and that scope goes away when your cocde completes.</div><div><div class="gmail_extra"><br></div><div class="gmail_extra">HTH</div><div class="gmail_extra">cheers -ben</div><div class="gmail_extra"><br><div class="gmail_quote">On 18 November 2017 at 15:36, RedTigerFish <span dir="ltr"><<a href="mailto:chihuyu@gmail.com" target="_blank">chihuyu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
<br>
<br>
Hello, friends.<br>
<br>
This problem which confuses me comes from a  question<br>
<<a href="http://forum.world.st/quot-Print-specific-integers-quot-Error-message-how-to-improve-and-what-causes-that-td5025067.html" rel="noreferrer" target="_blank">http://forum.world.st/quot-<wbr>Print-specific-integers-quot-<wbr>Error-message-how-to-improve-<wbr>and-what-causes-that-<wbr>td5025067.html</a>><br>
I asked in "Squeak - Beginners" days ago.<br>
<br>
These are some special integers: myArray := #(2 32 44 67 89 111 123)<br>
These special integers need to be specially labelled from integer 1 to 130.<br>
The rest normal numbers which myArray doesn't include will be printed also.<br>
<br>
Here's the code:<br>
<br>
*|a n myArray|<br>
<br>
myArray := #(2 32 44 67 89 111 123).<br>
<br>
n := 1.<br>
a := myArray at: n.<br>
<br>
1 to: 130 do: [:i|<br>
        i = a<br>
        ifTrue: [<br>
             Transcript show: ('Special number:  i = {1}, a = {2}' format:<br>
{i. a}).<br>
                 Transcript cr.<br>
                n := n + 1.<br>
                    n = 8<br>
                   ifTrue: [a := 'I am no longer a number'.]<br>
                   ifFalse: [a := myArray at: n. ].<br>
                ]<br>
          ifFalse: [<br>
                   Transcript show: ('i = {1}, a = {2}' format: {i. a}).<br>
                   Transcript  cr.<br>
                      ].<br>
        ].<br>
<br>
<br>
Transcript show: a; cr.     'Last line'<br>
*<br>
<br>
Now comes something that makes my head big.<br>
<br>
If I choose everything and do them, the last line, which should tell me what<br>
a is when program jumps out of the loop, exactly shows that a is "I am no<br>
longer a number".<br>
<br>
However, if I choose everything except the last line, and do them. After<br>
that, I do the last line. The output is nil.<br>
<br>
Why is a nil ?   Why's that?<br>
<br>
In order to make my question explicit, I recorded a video:<br>
<br>
<a href="https://www.youtube.com/watch?v=pUQAEO4uSpk" rel="noreferrer" target="_blank">https://www.youtube.com/watch?<wbr>v=pUQAEO4uSpk</a><br>
<br>
<br>
<br>
-----<br>
Dig, dig where you are,<br>
Down below's well.<br>
Let those that walk in darkness shout,<br>
Down below's hell.<br>
--<br>
Sent from: <a href="http://forum.world.st/Squeak-Beginners-f107673.html" rel="noreferrer" target="_blank">http://forum.world.st/Squeak-<wbr>Beginners-f107673.html</a><br>
______________________________<wbr>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.<wbr>squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://lists.squeakfoundation.<wbr>org/mailman/listinfo/beginners</a><br>
</blockquote></div><br></div></div></div>