() < () `() < ()` 类别 运算类积木 形狀 菱形积木

The () < () 积木 is an 运算类积木 and a 菱形积木. The 积木 checks if the first value is less than the second value. If it is less, the block returns true; if not, it returns false.

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:
```變數 [i v] 設為  // start at the front

變數 [i2 v] 設為 
重複直到 <<(清單第 (i) 項項目\( [numbers v] \) :: list) < (清單第 (i2) 項項目\( [numbers v] \) :: list)> 或 <(i2) > (清單 [numbers v] 的項目數 :: list)>>
變數 [i2 v] 改變 (1)
end
添加 (清單第 (i) 項項目\( [numbers v] \) :: list) 為第 ((i2) + (1)) 項\( [numbers v] \)
如果 <(i2) < ((i) + (1))> 那麼
刪除第 ((i) + (1)) 項 \( [numbers v] \)

刪除第 (i) 項 \( [numbers v] \)
end
變數 [i v] 改變 (1)
end
```
• Arranging a set of numbers/letters
```如果 <<(score) < (清單第 (1 v) 項項目\( [Top Scores v] \) :: list)> 且 <(score) > (清單第 (2 v) 項項目\( [Top Scores v] \) :: list)>> 那麼
添加 (score) 為第 (2 v) 項\( [list v] \)
end
```
• Evaluating numbers/letters
```變數 [i v] 設為 

如果 <(清單第 (i) 項項目\( [scores v] \) :: list) < (5)> 那麼
添加 [okay] 為第 (i) 項\( [evaluation v] \) // tells how the score is

如果 <(清單第 (i) 項項目\( [scores v] \) :: list) < (10)> 那麼
添加 [good] 為第 (i) 項\( [evaluation v] \)

添加 [great!] 為第 (i) 項\( [evaluation v] \)
end
end // if the score is lower than 5
變數 [i v] 改變 (1)
end
```
• Comparing different 变量s (e.g. comparing two characters' health in a game)
```如果 <(1 Health) < (2 Health)> 那麼
說出 [Player 2 wins]

說出 [Player 1 wins]
end
```
• Asking for an opinion on a scale of 1 to 10
```變數 [confirmed v] 設為  // stores yes or no is the answer is complete and acceptable

詢問 [How good are my cookies?] 並等待
如果 <<(詢問的答案) < (1)> 或 <(詢問的答案) > (10)>> 那麼
說出 [The response must be from 1 through 10] (2) 秒

變數 [confirmed v] 設為 
end
end
```

## 应用

Main article: List of Block Workarounds

The block can be replicated with the following code:

```<<<(a) > (b)> 或 <(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:

```<<(a) > (b)> 不成立>

<<(a) < (b)> 或 <(a) = (b)>>
```

The first workaround is more efficient.