Discuss Scratch

savaka
Scratcher
1000+ posts

Boolean variables :D

Chibi-Matoran wrote:

Zekrom01 wrote:

Chibi-Matoran wrote:

ItchyCatIII wrote:

No support.

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.
Can the not<> block store a value? No. In addition, doing <(variable) = > encourages bad programming practices. For a further explanation of my stance, see here.
<offtopic>Scratch is NOT encouraging bad practices. They are making it so students can get ready to do actual coding stuff.

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>
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) Comparisons are done using one = sign if you are programming on a TI calculator.
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.
Galleigo
Scratcher
500+ posts

Boolean variables :D

Simplified
I don't know what's your event :: events hat
if <escaping :: custom> then
set [Escaping... v] to (True)
else
set [Escaping... v] to (False)
end
And another sprite would check this.

((╯°□°)–︻╦╤─ – – – :: sensing) :: pen cap
Blocky, 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

Chibi-Matoran wrote:

Zekrom01 wrote:

Chibi-Matoran wrote:

Zekrom01 wrote:

Chibi-Matoran wrote:

ItchyCatIII wrote:

No support.

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.
Can the not<> block store a value? No. In addition, doing <(variable) = > encourages bad programming practices. For a further explanation of my stance, see here.
<offtopic>Scratch is NOT encouraging bad practices. They are making it so students can get ready to do actual coding stuff.

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>
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.
yea, and
<(var) = [1 ]>
is just as convenient.
No, it isn't.

How to use a Variable's Boolean value:
  1. Click on the Operators category
  2. Drag the <[] = []> block into the Boolean slot
  3. Click the Data category
  4. Drag the variable you want into one operand slot of the = block
  5. Type “true” in the other operand slot

How you should be able to use a Boolean-typed Variable's value:
  1. Click on the Data category
  2. Drag the variable you want into the Boolean slot
no support

((╯°□°)–︻╦╤─ – – – :: sensing) :: pen cap
Blocky, 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…

when green flag clicked
forever

if <(moving?) = [ true]> then

move (1) steps
end

end

no support


Yes
Inreal49
Scratcher
100+ posts

Boolean variables :D

alexphan wrote:

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

well, practically boolean variables are this
<ineeded variable>


Yes
Inreal49
Scratcher
100+ posts

Boolean variables :D

Diamond_Projects wrote:

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

EliteProgramming wrote:

no support

Easy to solve
The current situation causes bad habits when programming in other languages. “Easy to solve” doesn't justify all the reasons for the suggestion.
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

pvz_pro wrote:

no support reason: [easy workaround]
<(var)=[true]
if(x == true){}
The above is bad practice, which Scratch reinforces!
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

theonlygusti wrote:

I think it would be nice to be able to drag variables into boolean slots, and have them be evaluated as booleans implicitly.
sounds good
theonlygusti
Scratcher
1000+ posts

Boolean variables :D

pvz_pro wrote:

no support reason: [easy workaround]
<(var)=[true]

Inreal49 wrote:

ineeded because… well…

when green flag clicked
forever

if <(moving?) = [ true]> then

move (1) steps
end

end

no support
You guys just don't get the point of this suggestion….

This work around
  1. encourages poor programming habits
  2. is a necessity unique to Scratch
  3. is, honestly, a waste of time and energy
  4. has a higher potential for error (spelling “true” wrong, using inconsistent representations of booleans)

And, by the way:

Inreal49 wrote:

<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:

theonlygusti wrote:

drag variables into boolean slots, and have them be evaluated as booleans implicitly.

Sheep_maker
Scratcher
1000+ posts

Boolean variables :D

theonlygusti wrote:

I think it would be nice to be able to drag variables into boolean slots, and have them be evaluated as booleans implicitly.
Not just variables, but for all reporters.
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
set [Next loop v] to ( (a) > (1) )  // this variable now contains  the value "true" if a is 2
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
Do 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.
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?
savaka
Scratcher
1000+ posts

Boolean variables :D

Ger77 wrote:

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?
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:
define say number (number1)
say (number1) for (2) secs

say number (join [hello ] [world]) // says "hello world"
So that's why there are no data types.

Ger77 wrote:

if  <Last loop::variables> then
end
Fixed that (I think)
And this doesn't need a special variable type if reporters can just be put into boolean slots:

Sheep_maker wrote:

theonlygusti wrote:

I think it would be nice to be able to drag variables into boolean slots, and have them be evaluated as booleans implicitly.
Not just variables, but for all reporters.
Support for that.
*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.

Powered by DjangoBB