Skip to content

Instantly share code, notes, and snippets.

@s-hiiragi
Created January 6, 2022 03:59
Show Gist options
  • Save s-hiiragi/e09cb79040c46df6cb86f6b3a6315c45 to your computer and use it in GitHub Desktop.
Save s-hiiragi/e09cb79040c46df6cb86f6b3a6315c45 to your computer and use it in GitHub Desktop.
break/continueを使えるwhile/for
#define global _while(%1) repeat : if (%1) == 0 : break
#define global _for(%1,%2=0,%3=0,%4=1) %1=(%2) %c repeat %c if cnt {%1+=(%4)} %c if (%1) == (%3) {break}
mes "break/continueを使えるwhileのサンプル"
i = 0
_while i < 4
mes i
i++
loop
_while cnt < 5
if cnt \ 2 == 0 : s="even" : else : s="odd"
mes strf("%d (%s)", cnt, s)
if cnt == 3 : break
loop
mes "break/continueを使えるforのサンプル"
_for i,0,4
mes i
loop
_for i,0,4
if i \ 2 == 0 : s="even" : else : s="odd"
mes strf("%d (%s)", i, s)
if i == 3 : break
loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment