() and ()
2.0 () and ().png
Category Operators
Type Boolean

The () and () block is an Operators block and a Boolean block. The block joins two boolean blocks so they both have to be true to return true. If they are both true, the block returns true; if they are not all true or none true, it returns false.

This block can be stacked inside itself, which can be used to test more conditions.

Example Uses

This block is used for checking if two or more conditions are true at the same time. Some cases of this are:

  • Lose health if "I'm touching the fire and I do not have my shield up."
forever
if <<touching color [#f48302]?> and <not <(costume #) = [2]>>> then
change [lives v] by (-1)
  • Say a button is clicked if the mouse is touching it and the mouse is down.
forever
say <<mouse down?> and <touching [mouse-pointer v]?>>

Workaround

Main article: List of Block Workarounds


This block can be replicated with the following code:

<not <<not <condition1>> or <not <condition2>>>>

Another way to replicate this block is:

set [and v] to [false]
if <condition1> then
 if <condition2> then
  set [and v] to [true]
 end
end

See Also