# Euphoria loop until 語法

loop...until 循環與while循環類似，除了loop...until 循環保證能執行至少一次 .

## 語法:

loop...until 循環的語法是:

loop do
-- Statements to be executed.
until expression

## 示例:

#!/home/euphoria-4.0b2/bin/eui

integer a = 10

loop do
printf(1, "value of a : %d\n", a)
a = a + 1
until a < 20

value of a : 10
value of a : 11
value of a : 12
value of a : 13
value of a : 14
value of a : 15
value of a : 16
value of a : 17
value of a : 18
value of a : 19

# loop....with entry 語句:

with entry 語句提供的目的很好。需要使用此語句與loop...until 只需添加輸入關鍵字的時候，希望在第一次迭代開始。

## 語法:

loop...until loop with entry 的語法是:

loop with entry do
-- Statements to be executed.
entry
-- Initialisation statements.
until expression

## 例子:

#!/home/euphoria-4.0b2/bin/eui

integer a = 10

loop with entry do
printf(1, "value of a : %d\n", a)
a = a + 1
entry
a = a + 2
until a > 20

value of a : 12
value of a : 15
value of a : 18

# loop....label 語句:

loop...until 循環可以有一個標籤子句之前首先 do 關鍵字。enter 子句之前或之後，可以保持標籤 label 子句。

## 語法:

loop...until with label 子句的語法是:

loop label "Label Name" do
-- Statements to be executed.
until expression

## 示例:

#!/home/euphoria-4.0b2/bin/eui

integer a = 10
integer b = 20

loop label "OUTER" do
printf(1, "value of a : %d\n", a)
a = a + 1
loop label "INNER" do
printf(1, "value of b : %d\n", b)
b = b + 1
if b > 25 then
continue "OUTER" -- go to start of OUTER loop
end if
until b > 30
until a > 20

value of a : 10
value of b : 20
value of b : 21
value of b : 22
value of b : 23
value of b : 24
value of b : 25
value of a : 11
value of b : 26
value of a : 12
value of b : 27
value of a : 13
value of b : 28
value of a : 14
value of b : 29
value of a : 15
value of a : 16
value of a : 17
value of a : 18
value of a : 19