Discuss Scratch

starlightsparker
Scratcher
1000+ posts

Make, read, and delete variable blocks.

LP372 wrote:

Deleting variables already exists (kinda)
creating variables also exists–

in editor

this would do it in code
yadayadayadagoodbye
Scratcher
1000+ posts

Make, read, and delete variable blocks.

I see that this is meant to be for organization?

That is really the only use I can think of for this. In most cases in programming, you'd define your variables before everything else anyways.
medians
Scratcher
1000+ posts

Make, read, and delete variable blocks.

Other blocks too:
set variable name [name] to [0]::variables

change variable name [name] by (1)::variables
Edit: I'm not sure if he is active, but can the creator of the topic add this to the top (or sth like this)

Last edited by medians (Dec. 11, 2024 15:55:36)

mcsquaggle
Scratcher
500+ posts

Make, read, and delete variable blocks.

medians wrote:

Other blocks too:
set variable name [name] to [0]::variables

change variable name [name] by (1)::variables
Edit: I'm not sure if he is active, but can the creator of the topic add this to the top (or sth like this)
wouldn't that just be these though?
change [ v] by (0)

set [ v] to []
medians
Scratcher
1000+ posts

Make, read, and delete variable blocks.

mcsquaggle wrote:

medians wrote:

Other blocks too:
set variable name [name] to [0]::variables

change variable name [name] by (1)::variables
Edit: I'm not sure if he is active, but can the creator of the topic add this to the top (or sth like this)
wouldn't that just be these though?
change [ v] by (0)

set [ v] to []


You can't insert reporters there, and these would be used alongside the blocks in the original post. Did you read the original post??
hotcrystal
Scratcher
500+ posts

Make, read, and delete variable blocks.

I think we should differentiate between predetermined variables (regular variables in the editor right now) and disposable variables (mentioned here) (I want a better name than disposable). Predetermined variables are the ones that use the regular variable blocks, and the disposable variables are the ones can be created and deleted in the middle of programs mentioned here. Also, cloud variables should not be able to be disposable variables.

Last edited by hotcrystal (Dec. 11, 2024 21:38:40)

hotcrystal
Scratcher
500+ posts

Make, read, and delete variable blocks.

define bump()
forum.post(“Bump!”)
50_scratch_tabs
Scratcher
1000+ posts

Make, read, and delete variable blocks.

I do this with a list called “names” and one called “values”. To create a variable, add the name to “names” and add 0 to values. To set a variable use:
replace item (item # of (name) in [names v]) of [values v] with (new value)
And to get a variable do:
(item (item # of (name) in [names v]) of [values v] :: list)
So, after considering all of this, I WHOLE-HEARTEDLY SUPPORT! Maybe change the terminology a bit, but other than that great suggestion.
medians
Scratcher
1000+ posts

Make, read, and delete variable blocks.

50_scratch_tabs wrote:

I do this with a list called “names” and one called “values”. To create a variable, add the name to “names” and add 0 to values. To set a variable use:
replace item (item # of (name) in [names v]) of [values v] with (new value)
And to get a variable do:
(item (item # of (name) in [names v]) of [values v] :: list)
So, after considering all of this, I WHOLE-HEARTEDLY SUPPORT! Maybe change the terminology a bit, but other than that great suggestion.
There could also be set/change variable blocks considering those exist for variables currently, as I stated above for change.

Powered by DjangoBB