From Test-Scratch-Wiki

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

The () or () block is an Operators block and a Boolean block. The block joins two boolean blocks so any one of them can be true to return true — if at least one of them is true, the block returns true; if neither of them are true, it returns false.

This block can be stacked inside itself — this can be used to fit more booleans inside.

Example Uses

This script asks the user what their favorite color, and will give one response if it is "blue" or "red", and another response if it is anything else.

when green flag clicked
ask [What is your favorite color?] and wait
if < <(answer) = [blue]> or <(answer) = [red]> > then
say [I also like that color!]
else
say [That's a nice color!]
end

Workaround

Main article: List of Block Workarounds


This block can be replicated with the following code:

<not <<not <condition1>> and <not <condition2>>>>

This stack also works (with the variable T/F being the result):

set [T/F v] to [false]
if <condition1> then
set [T/F v] to [true]
end
if <condition2> then
set [T/F v] to [true]
end

See Also

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