From Test-Scratch-Wiki

The correct title of this article is () > () (block). The change of name is due to technical restrictions.


() > ()
2.0 () is Greater Than ().png
Category Operators
Type Boolean

The () > () block is an Operators block and a Boolean block. The block checks if the first value is greater than the other value. If the second value is less, the block returns true; if not, it returns false.

This block works with letters too, not just 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). Other rules of alphabetical order apply (e.g. zach > az). In Scratch 1.3 and previous versions, it only accepted numbers.

Example Uses

If a group must be arranged in size, this block can easily do the job.

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

  • Arranging a set of numbers/letters
if <(a) > (b)> then
say (join (b) (join [, ] (a))) for (2) secs
else
say (join (a) (join [, ] (b))) for (2) secs
end
  • Evaluating numbers/letters
repeat until <((a) + (b)) > (repcount)>
say (join [Checking i = ] (repcount)) for (2) secs
change [repcount v] by (1)
end
say (join [The answer is ] ((repcount) - (1)))
  • Comparing different variables (e.g. comparing two characters' health in a game)
if <(score1) > (score2)> then
say [Gotcha!] for (2) secs
end
  • Cloud highscores (used by many)
if <(Score) > (☁ Highscore)> then
set [☁ Highscore v] to (Score)
end

Workaround

Main article: List of Block Workarounds

The block can be replicated with the following code:

<not <<(a) < (b)> or <(a) = (b)>>>

See Also

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