() and ()
<> and <>
Category Operators
Type Boolean
Introduced in 11Oct03

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 only one is true or none are 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 [number v]) = [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)?>>
  • Checking if the final level has been beaten and the player has enough points
forever
if <<(level) = (20)> and <(score) > (999)>> :: control C
say [Congratulations! You beat the game!] for (5) seconds
stop [all v]

Workaround

Main article: List of Block Workarounds

This block can be replicated with one of the following:

not <<not <. . .:: grey>> or <not <. . .:: grey>>>
set [and v] to [false]
if <. . .::grey> then
    if <. . .::grey> then
        set [and v] to [true]
    end
end
<(<. . .:: grey> * <. . .:: grey>) = (1)>

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.