Discuss Scratch

medians
Scratcher
1000+ posts

Boolean variables :D

usefun wrote:

Gego51 wrote:

http://scratch.mit.edu/projects/10841526/
Don't advertise
Did you even look at the id of that project or the time of that post?? The project isn't even shared anymore.
https://scratch.mit.edu/discuss/post/60427/
usefun
Scratcher
1000+ posts

Boolean variables :D

deleted

Last edited by usefun (Jan. 11, 2024 04:35:27)

MythosLore
Scratcher
1000+ posts

Boolean variables :D

usefun wrote:

deleted
<boolean variable :: variables>
mjc9576
Scratcher
3 posts

Boolean variables :D

i know how to do constants which could be similar to what you want.
for a false constant use something like
if <[1] = [0]> then
say [ur code]
end
and for a true constant use something like
if <[1] = [1]> then
say [ur code]
end
starlightsparker
Scratcher
1000+ posts

Boolean variables :D

kNoobLauch wrote:

Yes, I can… but boolean variables would be also nice ._.
A lot of things would be nice but if there’s an easy workaround really what’s the point?
medians
Scratcher
1000+ posts

Boolean variables :D

Bringing this topic up.
Malicondi
Scratcher
1000+ posts

Boolean variables :D

<boolean variable ::variables> 
cool idea, but i think it might be a little annoying, and you can always set a variable to 0 or 1

but, if this allowed us to add a boolean that doesn't exist, that would be extremely helpful
medians
Scratcher
1000+ posts

Boolean variables :D

Bringing this topic up.
xXRedTheCoderXx
Scratcher
1000+ posts

Boolean variables :D

I think this would go great with a new toggle block, too.
toggle boolean [foo v] :: variables
In other programming languages, you can do something like
foo = !foo;
but in Scratch you'd have to do something like,
if <(foo) = [true]> then 
set [foo v] to [false]
else
set [foo v] to [true]
end

or::grey

set [foo v] to <not <(foo) = [true]>>
so a toggle block would save time and make code cleaner / more compact. So would this suggestion in general, as you'd be able to do just
if <foo::variables> then
...::grey
end

as opposed to::grey

if <(foo)=[true]> then
...::grey
end
Look how much more readable that is!

Last edited by xXRedTheCoderXx (March 3, 2024 03:41:47)

tenith
Scratcher
2 posts

Boolean variables :D

set [ v] to [true]
mjc9576
Scratcher
3 posts

Boolean variables :D

first one sets boolean variable, second one is to type “true” or “false” to easily choose which value to set your boolean variable to
set <> to <>
<[]>
cookieclickerer33
Scratcher
1000+ posts

Boolean variables :D

starlightsparker wrote:

kNoobLauch wrote:

Yes, I can… but boolean variables would be also nice ._.
A lot of things would be nice but if there’s an easy workaround really what’s the point?

Just like with
<[] < []>
It’s to make it faster to program things, you could just use the opposite inputs on the greater than block.

It’s similar with
change [var v] by (1)
You can just do this
set [var v] to ((var) + (1)
But it’s easier to use change by than it is to use set.


why do we have
say [] for (2) secs
think [] for (2) secs

When you can just do this

define say (thing) for (time) secs
say (thing::custom)
wait (time::custom) secs
say []

Last edited by cookieclickerer33 (March 11, 2024 11:30:52)

cookieclickerer33
Scratcher
1000+ posts

Boolean variables :D

Y’all seem to be overthinking this, all they need to do is allow us to do this
if (var) then

end
This would work perfectly fine and is only a few lines of code to change. I would know because I’ve done it before. It accepts the string “true” the Boolean “true” (yes they are different things) and the number and string “1”

They already do this with
if (item ( v) of [list v] :: list) then

end
Being allowed (for some reason we can only begin to comprehend) so just let variables do the same.

Last edited by cookieclickerer33 (March 11, 2024 11:34:11)

generalbrock2014
Scratcher
7 posts

Boolean variables :D

WELCOME TO THE SCRATCH 4.0 BLOCKS AND TODAY WE'RE GONNA MAKE BLOCKS INCLUDING YOU. Lets do some EXAMPLES!!!!!!!!!!!

Example #1 to #5 (motion)
I
I
I
v
touching x:()y:()? :: motion boolean // if sprite is touching the x and the y position of the sprite then it will report true else it will report false
if touching[edge v], bounce :: motion // if this sprite is touching something then it will bounce
point towards x:()y:() :: motion // it will point towards x and y
[sprite v] follow [sprite2 v] :: motion // the sprite will follow a another sprite
set[x v]to() :: motion // sets it into x or y

SCRATCH 4.0 IS COMING IN 2025!!!

Last edited by generalbrock2014 (May 9, 2024 15:57:22)

BigNate469
Scratcher
1000+ posts

Boolean variables :D

generalbrock2014 wrote:

WELCOME TO THE SCRATCH 4.0 BLOCKS AND TODAY WE'RE GONNA MAKE BLOCKS INCLUDING YOU. Lets do some EXAMPLES!!!!!!!!!!!

examples #1 to # 10
I
I
I
v
is pen down? :: pen boolean // r
There is no evidence that Scratch 4.0 is coming out, ever.
julmik6478
Scratcher
500+ posts

Boolean variables :D

vacuumfan7072 wrote:

if <variable=1>
if <variable=true>

dvd4 wrote:

You could also just set it to “true” or “false”.

if<(i)=>
}
*block here*
}
Why you don't use forum blocks?
Hawaiiscratcher67
Scratcher
16 posts

Boolean variables :D

You can just use
set [ v] to [1]
It's as simple as that.

Last edited by Hawaiiscratcher67 (May 11, 2024 13:37:53)

medians
Scratcher
1000+ posts

Boolean variables :D

Hawaiiscratcher67 wrote:

You can just use
set [ v] to [1]
It's as simple as that.
Yes, but you cannot fit those into boolean inputs, so you have to do:
<(var) = [1]>
Anyways, bringing this topic up.
medians
Scratcher
1000+ posts

Boolean variables :D

Bringing this topic up.
Foldy_TPOT
Scratcher
100+ posts

Boolean variables :D

No support.
if <condition::grey> then 
set [boolean variable v] to [true]


else
set [boolean variable v] to [false]
end

Powered by DjangoBB