From Test-Scratch-Wiki


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

The Not () block is an Operators block and a Boolean block. The block checks if the boolean inside it is false — if it is false, the block returns true; if the condition is true, it returns false.

Example Uses

This block can be used to "reverse" booleans.

Some common uses for the Not () block:

  • Making sure a key is not being pressed
forever 
if <not <key [a v] pressed?>> then
go to [Sprite2 v]
end
  • Making sure a variable does not equal a certain value
if <not <(lives) = [0]>> then
say [Continue] for (1) secs
else
stop [all v]
end
  • Making sure a list does not contain a certain item
if <not <[list v] contains [go]>> then
stop [all v]
end

Workaround

Main article: List of Block Workarounds

This block can be replicated with the following code:

<<condition> = [false]>

or

if <condition> then
set [result v] to [true]
else
set [result v] to [false]
end
Cookies help us deliver our services. By using our services, you agree to our use of cookies.