【AppleScript】ループ文の continue

AppleScript には、いわゆるループをスキップするという意味の「continue」がないようです。

以下は、参考サイト

log.ezura.asia

「repeat 1 times 」を間に挟んで 「exit repeat」するという手法を使っていました。

set myList to {}
repeat with i in {1, 2, 0, 15, 2, 2.1, 2, 3}
repeat 1 times--continue実現の為のrepeat
set i to i as number
if i = 2 then exit repeat
set myList to myList & i
end repeat
end repeat
return myList

返信を残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA