(Redirected from () is less than ())

The correct title of this article is () < () (block). The Scratch Wiki uses this different title because of technical restrictions.
() < ()
() < ()
Category Operators
Type Boolean

The () < () block is an Operators block and a Boolean block. The block reports true if the first value is less than the second value and false otherwise.

This block can compare both numbers and strings, which are ordered alphabetically. In Scratch 1.3 and previous versions, it only accepted numbers.

Example Uses

Some common uses for the () < () block are below:

set [i v] to [1]
repeat until <<(i) > (length of [scores v])> or <(item (i) of [scores v]) < (score)>>
    change [i v] by (1)
insert (score) at (i) of [scores v]
  • Evaluating numbers or letters
if <(score) < (5)> then
    say [Poor job.] for (1) secs
    stop [this script v]
if <(item (i) of [scores v]) < (10)> then
    say [Well done.] for (1) secs
    stop [this script v]
say [Great!] for (1) secs
if <(score 1) < (score 2)> then
    say [Player 2 wins!]
    say [Player 1 wins!]
  • Checking that a value is within a given range
ask [Please rate my cookies from 1 to 10.] and wait
repeat until <not <<(answer) < [1]> or <(answer) > [10]>>>
    ask [Please rate my cookies from 1 to 10.] and wait


Main article: List of Block Workarounds

The block can be replicated with the following code:

<(b) > (a)>

Less than or equal to

Sometimes it is necessary to know if a value is less than or equal to another value, but there is no block to do so. This can be done as follows:

<not <(a) > (b)>>

See Also

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