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?
let block does not appear in Variables
Moderator: MSandro
Re: let block does not appear in Variables
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
(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
Re: let block does not appear in Variables
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.
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.
Re: let block does not appear in Variables
" 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
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
Re: let block does not appear in Variables
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.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.
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.