let block does not appear in Variables

Report bugs. Post bug workarounds or fixes

Moderator: MSandro

Post Reply
bkgray
Posts: 12
Joined: Jul 31st, '17, 00:24

let block does not appear in Variables

Post by bkgray » Sep 27th, '17, 17:52

The "let" command can be added to a block by searching for it, but it does not appear in the Variables menu.

Is this intentional, or an oversight?

SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

Re: let block does not appear in Variables

Post by SimpleSi » Sep 27th, '17, 19:28

The "let" that you find when you search is a type of variable only available to you in developer mode

(To see it - go into developer mode and then scroll down the variables area and you'll see it at the bottom)

It is for creating temporary local variables for use inside scripts and the variables are not available outside the script they are declared in

To see what I mean - go into developer mode and run this attached script
notice if you click on the first one - it says 2

but if you click on the

set var to 3

and then click on the say var on its own - nothing is said as var isn't in scope and so has no value at that point

Simon
Attachments
0.gpp
(5.75 KiB) Downloaded 284 times

bkgray
Posts: 12
Joined: Jul 31st, '17, 00:24

Re: let block does not appear in Variables

Post by bkgray » Sep 27th, '17, 19:41

Thanks for your answer. I do see the let block in Variables with developer mode on.

Out of curiosity...any guess as to why it's visible in developer mode only? I think that the appropriate use of local variables in GP is useful, especially as my students transition to Java.

SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

Re: let block does not appear in Variables

Post by SimpleSi » Sep 27th, '17, 19:52

" I think that the appropriate use of local variables in GP is useful"
Best thing is to put a post into the Requests section

I thought I'd already made the same request but I can't find it amongst my zillion other ones :)

If you made one - it would stand out better :)

Simon

JohnM
Posts: 379
Joined: Sep 11th, '15, 14:42

Re: let block does not appear in Variables

Post by JohnM » Oct 2nd, '17, 22:21

Out of curiosity...any guess as to why it's visible in developer mode only? I think that the appropriate use of local variables in GP is useful, especially as my students transition to Java.
Yes, the "let" block is totally appropriate for your students. It requires entering "developer mode" because I worried that, for younger students (e.g. middle school) or beginners just learning the basics about variables, the idea of a temporary variable, whose scope is limited to a single script and which exists only while that script is running, might be too much to think about all at once. My idea was to let students get started without temporary variables, then introduce them later. However, I've been thinking mostly about middle-schoolers and the path for high-school students would be different. I'd be interested in your thoughts about this design choice, for both middle- and high-schooler.

If your students are ready, you might invite them to enter developer mode. Of course, that adds some additional blocks and categories to the palette, but they are probably ready for that, too.

Post Reply