Discuss Scratch
- PkmnQ
-
Scratcher
1000+ posts
___ or ___ but not both block [XOR]
No support. Honestly, why would anyone need xor anyway?
The not block is useful. You can use it to make sure a variable is not a certain value.
The and block is useful. You can use it to see if a sprite is being clicked.
The or block is useful. You can use it to know when either the enemy or the player has died.
What's the use for the xor block?
The not block is useful. You can use it to make sure a variable is not a certain value.
The and block is useful. You can use it to see if a sprite is being clicked.
The or block is useful. You can use it to know when either the enemy or the player has died.
What's the use for the xor block?
Last edited by PkmnQ (April 9, 2020 04:13:30)
- NxNmultiply
-
Scratcher
100+ posts
___ or ___ but not both block [XOR]
To repeat what AonymousProfessor said, and to apply it to the examples given above…
First, the example from ExtremeLogic:when green flag clickedThen your own example:
if < not <<(variable1) = [1]> = <(variable2) = [2]> > > then
Some Block
endwhen green flag clicked
forever
if <key [left arrow v] pressed?> then{
change x by (3)
}
else{
if <key [right arrow v] pressed?>{
change x by (-3)
}
end
Using “not (a=b)” is far more concise than using “(a or b) and (not (a and b))” - since Scratch lets you drop in booleans for a and b.
Wouldn't an else branch be used for this? (holy . I messed up the order of the two scripts)
when green flag clicked
forever
if < not < < key [left arrow v] pressed? > = < key [right v] pressed? > > > then
if <key [left arrow v] pressed?> then
change x by (3)
end
if <key [right arrow v] pressed?> then
change x by (-3)
end
end
end
- Mr_erson
-
Scratcher
58 posts
___ or ___ but not both block [XOR]
Thats an XOR. What you can do instead is:
if <<Var1> or <Var2>> then
if <not <[Var1] = [Var2]>> then
say [This is the workaround]
end
end
Last edited by Mr_erson (April 9, 2021 21:34:52)
- dhfbei8987
-
Scratcher
1000+ posts
___ or ___ but not both block [XOR]
Thats an XOR. What you can do instead is:incorrectly used, let me help correct your mistake:if <<Var1> or <Var2>> then
if <not <[Var1] = [Var2]>> then
say [This is the workaround]
end
end
if <not <[something] = [other something]>> then
do stuff::operators
end
- mumu245
-
Scratcher
1000+ posts
___ or ___ but not both block [XOR]
If it's too hard to understand, could this work?
<only one of <> <> ::operators>
- undeterminstic
-
Scratcher
1000+ posts
___ or ___ but not both block [XOR]
No support. Honestly, why would anyone need xor anyway?I support because we could use the xor block to solve a fun projecteuler question anyway that is my only reason.
The not block is useful. You can use it to make sure a variable is not a certain value.
The and block is useful. You can use it to see if a sprite is being clicked.
The or block is useful. You can use it to know when either the enemy or the player has died.
What's the use for the xor block?
- EDawg2011
-
Scratcher
1000+ posts
___ or ___ but not both block [XOR]
I've seen 2 main workarounds for this block.
The problem with this workaround is that not everyone knows they can put boolean blocks in those white spaces.
The problem with this workaround is that it could be annoying to do every time you want a xor function in your project.
Not everyone knows what xor is and I feel like this block would be useful for some people; support.
<not <<1::#888888> = <2::#888888>>>
The problem with this workaround is that not everyone knows they can put boolean blocks in those white spaces.
<<<1::#888888> or <2::#888888>> and <not <<1::#888888> and <2::#888888>>>>
The problem with this workaround is that it could be annoying to do every time you want a xor function in your project.
If it's too hard to understand, could this work?That wouldn't work because that is ambiguous; the condition would be true if only one of these conditions what? Here's a non-ambiguous version:<only one of <> <> ::operators>
only one of <1::#888888> and <2::#888888> is true?::boolean operators
Not everyone knows what xor is and I feel like this block would be useful for some people; support.
- starlightsparker
-
Scratcher
1000+ posts
___ or ___ but not both block [XOR]
only one of <1::#888888> and <2::#888888> is true?::boolean operators
i support this block because xor is confusing for some.
Last edited by starlightsparker (Feb. 25, 2024 15:45:16)
- undeterminstic
-
Scratcher
1000+ posts
___ or ___ but not both block [XOR]
i have been on scratch for 4 years and haven't founda usage for it. where would it be used
- kkidslogin
-
Scratcher
1000+ posts
___ or ___ but not both block [XOR]
(#50)Specific kinds of logic, encoding, and bitwise operations.
i have been on scratch for 4 years and haven't founda usage for it. where would it be used
- CodeComet6161
-
Scratcher
1000+ posts
___ or ___ but not both block [XOR]
Workaround:
if <<<(a) = [true]> and <(b) = [false]>> or <<(a) = [false]> and <(b) = [true]>>> then
something
something
something
end
- NPLol39-2_
-
Scratcher
100+ posts
___ or ___ but not both block [XOR]
There's a simple workaround:
Also, Scratch is meant to be intuitive for all ages. Calling it XOR would be confusing to most people.
<not <<boolean :: grey> = <boolean2 :: grey>>> //works as XORThis workaround was mentioned 11 years ago.
<<boolean :: grey> = <boolean2 :: grey>> //works as not XOR (both booleans are true or false)
Also, Scratch is meant to be intuitive for all ages. Calling it XOR would be confusing to most people.










