- The correct title of this article is () < () (block). The Scratch Wiki uses this different title because of technical restrictions.
|() < ()|
() < ()
This block works with letters too, as well as numbers. In Scratch, letters at the top of the alphabet (e.g. a, b, c) are worth less than letters at the end (e.g. x, y, z). In Scratch 1.3 and previous versions, it only accepted numbers.
Some common uses for the () < () block are below:
- If a group must be arranged in size, this block can easily do the job by iterating through a list and checking if each value is less than the rest until placement is detected. For example, if a list is supposed to be sorted from greatest to least, the following script can accomplish this:
set [i v] to  //start at the front repeat (length of [numbers v]) set [i2 v] to  repeat until <<(item (i) of [numbers v]) < (item (i2) of [numbers v])> or <(i2) > (length of [numbers v]) change [i2 v] by (1) end insert (item (i) of [numbers v]) at ((i2) + (1)) of [numbers v] if <(i2) < ((i) + (1))> then delete ((i) + (1)) of [numbers v] else delete (i) of [numbers v] end change [i v] by (1) end
- Arranging a set of numbers/letters
if <<(score) < (item (1 v) of [Top Scores v])> and <(score) > (item (2 v) of [Top Scores v])>> then insert (score) at (2 v) of [list v] end
- Evaluating numbers/letters
set [i v] to  delete [all v] of [evaluation v] repeat (length of [scores v]) if <(item (i) of [scores v]) < (5)> then //if the score is lower than 5 insert [okay] at (i) of [evaluation v] //tells how the score is else if <(item (i) of [scores v]) < (10)> then insert [good] at (i) of [evaluation v] else insert [great!] at (i) of [evaluation v] end end change [i v] by (1)
- Comparing different variables (e.g. comparing two characters' health in a game)
if <(1 Health) < (2 Health)> then say [Player 2 wins] else say [Player 1 wins] end
- Asking for an opinion on a scale of 1 to 10
set [confirmed v] to  //stores yes or no is the answer is complete and acceptable repeat until <(confirmed) = > ask [How good are my cookies?] and wait if <<(answer) < (1)> or <(answer) > (10)>> then say [The response must be from 1 through 10] for (2) secs else set [confirmed v] to  end end
- Main article: List of Block Workarounds
The block can be replicated with the following code:
<not <<(a) > (b)> or <(a) = (b)>>>
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. However, it can be worked around in two ways:
<not <(a) > (b)>> <<(a) < (b)> or <(a) = (b)>>
The first workaround is more efficient.