Discuss Scratch

Foldy_TPOT
Scratcher
100+ posts

Boolean variables :D

BigNate469 wrote:

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
ispendown? r
There is no evidence that Scratch 4.0 is coming out, ever.
True.
medians
Scratcher
1000+ posts

Boolean variables :D

Foldy_TPOT wrote:

No support.
ifconditionthensetboolean variabletotrueelsesetboolean variabletofalse
1. Why not just set the variable to the condition??
2. Variables cannot fit in boolean inputs, so you have to do = [1] or = [true]

Last edited by medians (June 15, 2024 17:23:45)

medians
Scratcher
1000+ posts

Boolean variables :D

Bringing this topic up.
medians
Scratcher
1000+ posts

Boolean variables :D

medians wrote:

Bringing this topic up.
8to16
Scratcher
1000+ posts

Boolean variables :D

medians wrote:

medians wrote:

Bringing this topic up.

cookieclickerer33
Scratcher
1000+ posts

Boolean variables :D

cookieclickerer33 wrote:

Y’all seem to be overthinking this, all they need to do is allow us to do this
ifvarthen
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
ifitemoflistthen
Being allowed (for some reason we can only begin to comprehend) so just let variables do the same.
I did some modding, the reason you can do this is because the item of list block can be placed in any input slot, even if it’s read only.

If you have custom reporters, you can even place the block into the define hat
medians
Scratcher
1000+ posts

Boolean variables :D

Bringing this topic up.
epicdude512
Scratcher
100+ posts

Boolean variables :D

What would this accomplish that normal variables could not? why would i ever use a variable with only 2 possible outputs instead of a normal variable where the possible outputs are literally infinite.
MillionOfficial
Scratcher
500+ posts

Boolean variables :D

kNoobLauch wrote:

Yes, I can… but boolean variables would be also nice ._.

Because she's lazy.

Support and

BUMP

Last edited by MillionOfficial (Nov. 13, 2024 14:45:07)

MillionOfficial
Scratcher
500+ posts

Boolean variables :D

drmcw wrote:

alexphan wrote:

One question: WHAT ARE BOOLEAN VARIABLES???????!?!?!?:o

A variable that can be either true or false. If it was a Scratch block it would have pointy ends.
It looks like this:

abooleanvariable
epicdude512
Scratcher
100+ posts

Boolean variables :D

MillionOfficial wrote:

kNoobLauch wrote:

Yes, I can… but boolean variables would be also nice ._.

Because she's lazy.

Support and

BUMP
Why do you support, also you cant bump a post that has been bumped in the last 24 hours or is on the front page
medians
Scratcher
1000+ posts

Boolean variables :D

epicdude512 wrote:

What would this accomplish that normal variables could not? why would i ever use a variable with only 2 possible outputs instead of a normal variable where the possible outputs are literally infinite.
You would be able to put it in boolean inputs as well (which you cannot currently do with variables, and when this topic was made, the item () of () and item # of () in () block could not be put in boolean inputs without hacked blocks), and also, I've seen a lot of cases (ex. clones and toggles) where someone would only want booleans.
epicdude512
Scratcher
100+ posts

Boolean variables :D

medians wrote:

epicdude512 wrote:

What would this accomplish that normal variables could not? why would i ever use a variable with only 2 possible outputs instead of a normal variable where the possible outputs are literally infinite.
You would be able to put it in boolean inputs as well (which you cannot currently do with variables, and when this topic was made, the item () of () and item # of () in () block could not be put in boolean inputs without hacked blocks), and also, I've seen a lot of cases (ex. clones and toggles) where someone would only want booleans.
Sorry if im not understanding correctly (im trying to cut down on my caffine intake and im having a major energy crash because of it), but if you mean what i think you are saying, i sort of get the second part that it would be helpful back then, but if for the first part you mean you cant put variables in blocks like this
ifthen
the first part could be probably solved with
foo=true

but for the third point if you mean someone could only want yes or no, why would we need a whole new block for that when we could just use a variable to do the exact same task
medians
Scratcher
1000+ posts

Boolean variables :D

epicdude512 wrote:

medians wrote:

epicdude512 wrote:

What would this accomplish that normal variables could not? why would i ever use a variable with only 2 possible outputs instead of a normal variable where the possible outputs are literally infinite.
You would be able to put it in boolean inputs as well (which you cannot currently do with variables, and when this topic was made, the item () of () and item # of () in () block could not be put in boolean inputs without hacked blocks), and also, I've seen a lot of cases (ex. clones and toggles) where someone would only want booleans.
Sorry if im not understanding correctly (im trying to cut down on my caffine intake and im having a major energy crash because of it), but if you mean what i think you are saying, i sort of get the second part that it would be helpful back then, but if for the first part you mean you cant put variables in blocks like this
ifthen
the first part could be probably solved with
foo=true

but for the third point if you mean someone could only want yes or no, why would we need a whole new block for that when we could just use a variable to do the exact same task
Yea, but the point of this suggestion is so you don't have to do that, since variables can be booleans in other programming languages (you can have variables that can only be booleans in a lot of languages) and you don't have to do that in other languages because it is redundant. Though Scratch could also just add the ability to put variables into boolean inputs, like this:
iffoothenelse

Last edited by medians (Nov. 13, 2024 15:19:53)

epicdude512
Scratcher
100+ posts

Boolean variables :D

medians wrote:

Yea, but the point of this suggestion is so you don't have to do that, since variables can be booleans in other programming languages (you can have variables that can only be booleans in a lot of languages) and you don't have to do that in other languages because it is redundant. Though Scratch could also just add the ability to put variables into boolean inputs, like this:
iffoothenelse

ok, im mixed about that solution because while its good to know in the future, it would be absolutely confusing for someone who does not know what that means, as i feel like this
iffoo=truethen

is much easier to understand than

iffoothen
. but like i said, if you figure out what it means, you probably will be better at coding off scratch, however i dont support making it its own block/option, as its basically just another block thats worse than another
jonsonfan
Scratcher
100+ posts

Boolean variables :D

well even tho it whould be easy to work with for some users new scratchers can be confused by this and you can already do stuff like this with blocks like this


whenclickedvar1<var2sonosupport
8to16
Scratcher
1000+ posts

Boolean variables :D

jonsonfan wrote:

(#336)
well even tho it whould be easy to work with for some users new scratchers can be confused by this and you can already do stuff like this with blocks like this
whenclickedvar1<var2sonosupport
New scratchers won't know that workaround, this would be easier to understand

And close your scratchblocks tags please

8to16
medians
Scratcher
1000+ posts

Boolean variables :D

epicdude512 wrote:

ok, im mixed about that solution because while its good to know in the future, it would be absolutely confusing for someone who does not know what that means, as i feel like this

but like i said, if you figure out what it means, you probably will be better at coding off scratch, however i dont support making it its own block/option, as its basically just another block thats worse than another
You can already do that though for the item () of () block, and the item # of () in () block though, so that's why I suggested it as an alternative solution:

medians
Scratcher
1000+ posts

Boolean variables :D

StarSubject wrote:

medians wrote:

epicdude512 wrote:

ok, im mixed about that solution because while its good to know in the future, it would be absolutely confusing for someone who does not know what that means, as i feel like this

but like i said, if you figure out what it means, you probably will be better at coding off scratch, however i dont support making it its own block/option, as its basically just another block thats worse than another
You can already do that though for the item () of () block, and the item # of () in () block though, so that's why I suggested it as an alternative solution:

What does that do anyways? Like how does it work?
If you have a truthy value (ex. true/1), then it runs, like a boolean. The second one just works like the contains list block since it will report 0 if the list doesn't contain the entered string and a positive number otherwise. If that solution was implemented, then having a truthy value for the variable would do the same thing.

Last edited by medians (Nov. 20, 2024 21:42:00)

mcsquaggle
Scratcher
500+ posts

Boolean variables :D

support, logic variables are a real timesaver when it comes to coding. as for the whole “too confusing for new scratchers” argument:
that is why tutorials exist, a way for scratchers to look at instructions and an explanation on how its used, what it does, and ect. furthermore, that argument can be applied to things like lists, custom blocks, and these blocks
absof9dayssince2000distanceto

Powered by DjangoBB