We need to have blocks that create/delete variables as part of the script.
Like this.whenclicked
create variableBlahsetBlah ▼to1delete variableBlah
Last edited by Unknown164 (2013-04-09 22:27:30)
Offline
Unknown164 wrote:
We need to have blocks that create/delete variables as part of the script.
Like this.whenclicked
create variableBlahsetBlah ▼to1delete variableBlah
You wouldn't have to have the clutter of a bunch of variables, just a few at a time that are deleted when they are not needed, and created when they are.
I think this way is better because that is how variables function in most programming languages.
Offline
I do not think this is pretty unnecessary, as you don't really have any reason to have to delete a variable. Or, at least I haven't needed to. But if you for some reason of had to, there is a work-around for it. Just set the variable to something that won't affect the project. Like "[not used]" or something.
I don't know, I don't know if you have my support or not, yet. Could you tell me how you think this would be useful, because I just can't think of any times this would actually be useful rather than just organization.
Offline
A script variable instead would be good too. Not displayed as a variable, but able to store numbers like one.
Or maybe just an easier way to make a for loop. That'll help a lot.
Re: Useful
Looping.
Offline
I think Scratch shouldn't have variables made manually.
It'd match JS, python, and most of those other languages to create variables in script.
(var count = 3 or whatever)
Oh wait. But then I forgot that Scratch is drag-and-drop and that won't work out never mind
Offline
kayybee wrote:
I think Scratch shouldn't have variables made manually.
It'd match JS, python, and most of those other languages to create variables in script.
(var count = 3 or whatever)
Oh wait. But then I forgot that Scratch is drag-and-drop and that won't work out never mind
So?
What's wrong with script variables, like BYOB does?
Offline
kayybee wrote:
I think Scratch shouldn't have variables made manually.
It'd match JS, python, and most of those other languages to create variables in script.
(var count = 3 or whatever)
Oh wait. But then I forgot that Scratch is drag-and-drop and that won't work out never mind
It would work if they were typed into a block like this
Anyway, the problem isn't to have to delete any variables, it's creating them when you want to store something in them. Of course that's what lists are for so I find this totally unnecessary.variable
Offline
LS97 wrote:
kayybee wrote:
I think Scratch shouldn't have variables made manually.
It'd match JS, python, and most of those other languages to create variables in script.
(var count = 3 or whatever)
Oh wait. But then I forgot that Scratch is drag-and-drop and that won't work out never mindIt would work if they were typed into a block like this
Anyway, the problem isn't to have to delete any variables, it's creating them when you want to store something in them. Of course that's what lists are for so I find this totally unnecessary.variable
But lists make code less understandable and tidy, and longer. Using item 1 of list: things, item 2 of list: things e.t.c. is less easily understandable than named variables such as x vel, y vel, score... I think something like temp variables that are declared at the start of a script like in squeak or script variables like in byob are much better than the current system.
Offline
mythbusteranimator wrote:
kayybee wrote:
I think Scratch shouldn't have variables made manually.
It'd match JS, python, and most of those other languages to create variables in script.
(var count = 3 or whatever)
Oh wait. But then I forgot that Scratch is drag-and-drop and that won't work out never mindSo?
What's wrong with script variables, like BYOB does?
No I meant completely removing manually created variables.
Offline
kayybee wrote:
mythbusteranimator wrote:
kayybee wrote:
I think Scratch shouldn't have variables made manually.
It'd match JS, python, and most of those other languages to create variables in script.
(var count = 3 or whatever)
Oh wait. But then I forgot that Scratch is drag-and-drop and that won't work out never mindSo?
What's wrong with script variables, like BYOB does?No I meant completely removing manually created variables.
You can't delete variables in PHP or JS
Offline
mythbusteranimator wrote:
kayybee wrote:
mythbusteranimator wrote:
So?
What's wrong with script variables, like BYOB does?No I meant completely removing manually created variables.
You can't delete variables in PHP or JS
PHP:
unset($var);
JS:
delete variable;
Offline
Unknown164 wrote:
We need to have blocks that create/delete variables as part of the script.
Like this.whenclicked
create variableBlahsetBlah ▼to1delete variableBlah
You wouldn't have to have the clutter of a bunch of variables, just a few at a time that are deleted when they are not needed, and created when they are.
Great idea!
Last edited by joshuaho (2013-04-12 12:40:03)
Offline
You could use lists for this though. Good Idea anyway.
and here are some improved versions of the main variables you did.
create variablevariable ▼delete variablevariable ▼when variablevariable ▼createdwhen variablevariable ▼deletedif variablevariable ▼is createdif variablevariable ▼is deleted
Last edited by topazdragonlord (2013-04-12 12:55:39)
Offline
Hey, I once made a variable caled "Blah"!!
Offline
While local script variables à-la BYOB are a good idea, typing variable names in scratch is going to open a new dimension of errors about typos, variables that are not created yet and new scratchers wondering why they cannot access not-yet-initialized variables anymore.
Offline