Discuss Scratch
- Discussion Forums
- » Suggestions
- » Boolean variables :D
- savaka
- Scratcher
1000+ posts
Boolean variables :D
(offtopic) Comparisons are done using one = sign if you are programming on a TI calculator.I wasn't criticizing == in my post. I was saying that Scratchers should be able to directly put a variable in a hexagonal Boolean slot instead of using the comparison operator block. What happens currently is that the Boolean value stored in the variable is casted to a String and compared to the String “true” using the <[] = []> block. Putting a variable in a Boolean slot would not be confusing, and it would actually be more convenient.<offtopic>Scratch is NOT encouraging bad practices. They are making it so students can get ready to do actual coding stuff.Can the not<> block store a value? No. In addition, doing <(variable) = > encourages bad programming practices. For a further explanation of my stance, see No support.here.
There is a very simple workaround that not too many people know:
A blank boolean slot returns “false”<not <>>without anything in it, returns true.
And for those who have not figured that out, there is the variable method, which may be slightly annoying but not too hard to figure out or do.
Scratch is meant to get starting users on a low floor, not a high ceiling. Also, = and == can get really confusing because they mean 2 different things. And you do know people under the age of 10 use Scratch, right? .</offtopic>
- Scratcher1002
- Scratcher
1000+ posts
Boolean variables :D
Also, the thing is, in other languages this is implemented. There are several variables, booleans, etc. (C++) I support.
・Scratcher1002は「ここにランダムな日本語の言葉はたくさんですか?はい」と言いました・
||||Search:
Topics | Users
||Studios | Projects
||
||||Search:
Topics | Users
||Studios | Projects
||
- Galleigo
- Scratcher
500+ posts
Boolean variables :D
Simplified
I don't know what's your event :: events hatAnd another sprite would check this.
if <escaping :: custom> then
set [Escaping... v] to (True)
else
set [Escaping... v] to (False)
end
((╯°□°)–︻╦╤─ – – – :: sensing) :: pen capBlocky, a young guard block, guards my signature from kumquats. Still trying to teach him how to shoot the kumquat instead of my signature. By the way, all these coloured URLs still work. Cool, huh? (Sorry for the insane bolding, italicising and underlining. :P)
CYBERSPHERE. They keep coming. It never ends. Can't stop. Won't stop.
My shop is here. Go check it out!
BEAT. How fast are your reflexes?
Space Debris.Tiny floating colourful particles. Nothing much.
Do YOU want to rule? Let's discuss the Rules for Rulers.
Interested in space? Check out The Solar System - Our Home in Space. I was too lazy to colour that one.
ORBIT. Dodge everything to survive!
- Galleigo
- Scratcher
500+ posts
Boolean variables :D
no supportNo, it isn't.yea, andI wasn't criticizing == in my post. I was saying that Scratchers should be able to directly put a variable in a hexagonal Boolean slot instead of using the comparison operator block. What happens currently is that the Boolean value stored in the variable is casted to a String and compared to the String “true” using the <[] = []> block. Putting a variable in a Boolean slot would not be confusing, and it would actually be more convenient.<offtopic>Scratch is NOT encouraging bad practices. They are making it so students can get ready to do actual coding stuff.Can the not<> block store a value? No. In addition, doing <(variable) = > encourages bad programming practices. For a further explanation of my stance, see No support.here.
There is a very simple workaround that not too many people know:
A blank boolean slot returns “false”<not <>>without anything in it, returns true.
And for those who have not figured that out, there is the variable method, which may be slightly annoying but not too hard to figure out or do.
Scratch is meant to get starting users on a low floor, not a high ceiling. Also, = and == can get really confusing because they mean 2 different things. And you do know people under the age of 10 use Scratch, right? .</offtopic><(var) = [1 ]>is just as convenient.
How to use a Variable's Boolean value:
- Click on the Operators category
- Drag the <[] = []> block into the Boolean slot
- Click the Data category
- Drag the variable you want into one operand slot of the = block
- Type “true” in the other operand slot
How you should be able to use a Boolean-typed Variable's value:
- Click on the Data category
- Drag the variable you want into the Boolean slot
((╯°□°)–︻╦╤─ – – – :: sensing) :: pen capBlocky, a young guard block, guards my signature from kumquats. Still trying to teach him how to shoot the kumquat instead of my signature. By the way, all these coloured URLs still work. Cool, huh? (Sorry for the insane bolding, italicising and underlining. :P)
CYBERSPHERE. They keep coming. It never ends. Can't stop. Won't stop.
My shop is here. Go check it out!
BEAT. How fast are your reflexes?
Space Debris.Tiny floating colourful particles. Nothing much.
Do YOU want to rule? Let's discuss the Rules for Rulers.
Interested in space? Check out The Solar System - Our Home in Space. I was too lazy to colour that one.
ORBIT. Dodge everything to survive!
- Sheep_maker
- Scratcher
1000+ posts
Boolean variables :D
Support for being able to drag reporters into boolean slots. “True” or “1” will be considered true, and all other values will be false.
- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
- Inreal49
- Scratcher
100+ posts
Boolean variables :D
ineeded because… well…
no support
when green flag clicked
forever
if <(moving?) = [ true]> then
move (1) steps
end
end
no support
Yes
- Inreal49
- Scratcher
100+ posts
Boolean variables :D
WHAT ARE BOOLEAN VARIABLES???????!?!?!?:oOne question:
well, practically boolean variables are this
<ineeded variable>
Yes
- Inreal49
- Scratcher
100+ posts
Boolean variables :D
Don't forget:set [ v] to [true v]And I support.
ineeded because
set [ v] to [ true]
lol
Yes
- EliteProgramming
- Scratcher
100+ posts
Boolean variables :D
no support
Easy to solve
Providing Platinum Quality Memes™
- gdpr533f604550b2f20900645890
- Scratcher
1000+ posts
Boolean variables :D
The current situation causes bad habits when programming in other languages. “Easy to solve” doesn't justify all the reasons for the suggestion.no support
Easy to solve
- pvz_pro
- Scratcher
500+ posts
Boolean variables :D
no support reason: [easy workaround]
<(var)=[true]
if you are reading this, ok
- gdpr533f604550b2f20900645890
- Scratcher
1000+ posts
Boolean variables :D
no support reason: [easy workaround]
<(var)=[true]
if(x == true){}
- theonlygusti
- Scratcher
1000+ posts
Boolean variables :D
I think it would be nice to be able to drag variables into boolean slots, and have them be evaluated as booleans implicitly.
- savaka
- Scratcher
1000+ posts
Boolean variables :D
sounds good I think it would be nice to be able to drag variables into boolean slots, and have them be evaluated as booleans implicitly.
- theonlygusti
- Scratcher
1000+ posts
Boolean variables :D
no support reason: [easy workaround]
<(var)=[true]
You guys just don't get the point of this suggestion…. ineeded because… well…when green flag clicked
forever
if <(moving?) = [ true]> then
move (1) steps
end
end
no support
This work around
- encourages poor programming habits
- is a necessity unique to Scratch
- is, honestly, a waste of time and energy
- has a higher potential for error (spelling “true” wrong, using inconsistent representations of booleans)
And, by the way:
<ineeded variable>
Learn to spell unneeded, and don't be so mean.
- theonlygusti
- Scratcher
1000+ posts
Boolean variables :D
For the record, I support this:
drag variables into boolean slots, and have them be evaluated as booleans implicitly.
- Sheep_maker
- Scratcher
1000+ posts
Boolean variables :D
Not just variables, but for all reporters. I think it would be nice to be able to drag variables into boolean slots, and have them be evaluated as booleans implicitly.
Support for that.
- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
- Ger77
- Scratcher
21 posts
Boolean variables :D
This suggestion seem logic because I do not understand why it is possible to choose “Boolean”, “Text” and “Number” in the definition of a custom block for a parameter, but not for a normal variable?
And for more confusing. You could set a normal Variable to “true” or “false” if your source is a Boolean operator
What do you think?
And for more confusing. You could set a normal Variable to “true” or “false” if your source is a Boolean operator
set [Next loop v] to ( (a) > (1) ) // this variable now contains the value "true" if a is 2Do this not make more problems to beginners instead of an existing Boolean-Typ? Such variable could have a name to describe the decision which is to make.
set [Last loop v] to ( (a) = (3) ) // this other variable now contains the value "false" if a = 2
set [Next loop v] to ( (a) > (1) ) // this variable still contains the value "true" if a is 3
set [Last loop v] to ( (a) = (3) ) // this other variable now contains the value "true" if a = 3
if ( ( Last loop )::operators ) then
end
What do you think?
Last edited by Ger77 (April 23, 2016 22:07:31)
- Scratcher1002
- Scratcher
1000+ posts
Boolean variables :D
I support if I haven't. I know it is in other languages, why not Scratch?
・Scratcher1002は「ここにランダムな日本語の言葉はたくさんですか?はい」と言いました・
||||Search:
Topics | Users
||Studios | Projects
||
||||Search:
Topics | Users
||Studios | Projects
||
- savaka
- Scratcher
1000+ posts
Boolean variables :D
The “Number,” “String,” and “Boolean” custom block parameters aren't accepting different data types (because Scratch has no data types), they just limit what you can input in order to make it more clear how to use the block. Number and boolean* aren't even at all necessary because all they do is limit your input to make it clear how to use the created block. Number inputs limit typed input to only numbers, and boolean inputs accept no typed input and only accept boolean reporter blocks. Since number inputs still accept all reporters, this will actually work: This suggestion seem logic because I do not understand why it is possible to choose “Boolean”, “Text” and “Number” in the definition of a custom block for a parameter, but not for a normal variable?
define say number (number1)So that's why there are no data types.
say (number1) for (2) secs
say number (join [hello ] [world]) // says "hello world"
Fixed that (I think)if <Last loop::variables> then
end
And this doesn't need a special variable type if reporters can just be put into boolean slots:
*Actually, boolean is the only parameter that can be put in a boolean slot, but that would be fixed with theonlygusti and Sheep_maker's suggestions.Not just variables, but for all reporters. I think it would be nice to be able to drag variables into boolean slots, and have them be evaluated as booleans implicitly.
Support for that.
- Discussion Forums
- » Suggestions
- » Boolean variables :D