AppleScript/制御文

条件分岐 if ... then ... else ... end if

set a to random number from 1 to 3
if a is equal to 1 then
display dialog "1"
else if a is equal to 2 then
display dialog "2"
else
display dialog "other"
end if

繰り返し repeat ... end repeat

set n to 0
repeat
if n is greater than or equal to 5 then
exit repeat
end if
set n to n + 1
end repeat
set n to 0
repeat while n is less than 5
set n to n + 1
end repeat
repeat with i in {"aba", "abe", "hoge", "jaa"}
display dialog i
end repeat