Break

From MiniScript Wiki
Revision as of 10:37, 10 April 2025 by Machiaworx (talk | contribs) (add introduce, example.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

break is a keyword statement that jumps out of the innermost for or while loop. If you want to stop a loop under a specific condition while processing a for or while statement, use the break statement.

Conversely, if you want to skip subsequent processing and enter the next loop, use the Continue statement.

Example

str="I may use pencil."
result=""
for i in str
  if i=="a" or i=="e" then break  //aかeが出てきた時点で処理自体が終了する。
  result=result+i
end for
print result

Output

i m