alice-teacher Do in order scope issue in Alice 3

Ziccardi, Adam aziccardi at opschools.org
Wed May 18 15:26:01 EDT 2022


Nicely illustrated 'technicality'.
What's the logic or reason for the inner DoTogether containing only the
num1 and nums initializers?
Is this exercise only to show the scope doesn't extend outward?
AZ

On Wed, May 18, 2022 at 1:45 PM Leonel Morales <litomd at gmail.com> wrote:

> I guess it has to do with blocks' translation into Java. Do in order
> translation places all instructions inside curly brackets creating a
> semantic scope.
>
> I examined the code with the "Java code on the side" option and obtained
> this:
>
> [image: image.png]
>
> And it works... not sure if it should.
>
> Regards,
>
> El mié, 18 may 2022 a las 10:43, Carlos Bovell via alice-teachers (<
> alice-teachers at lists.andrew.cmu.edu>) escribió:
>
>> Hi,
>>
>> In Alice 3, the do in order control structure limits scope. Is there a
>> reason for that? In the attached screenshot, the variable outside the do in
>> order can't be assigned any of the variables' values that were declared
>> inside the do in order.
>>
>> Carlos
>>
>>
>> _______________________________________________
>> alice-teachers mailing list
>> alice-teachers at lists.andrew.cmu.edu
>> To change settings or unsubscribe visit:
>> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers
>
> _______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> To change settings or unsubscribe visit:
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers



-- 
Adam Ziccardi
716-209-6482
OPTA president
K-12 CS coordinator
NYS Master Teacher
Teacher Webpage <https://www.opschools.org/Domain/2958>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20220518/2c48c2c3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 142318 bytes
Desc: not available
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20220518/2c48c2c3/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 186852 bytes
Desc: not available
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20220518/2c48c2c3/attachment-0003.png>


More information about the alice-teachers mailing list