Difference between revisions of "Continue"
Jump to navigation
Jump to search
(Created page with "<c>continue</c> is a keyword statement that causes execution to jump directly to the next iteration of a for or while loop. Category:Language...") |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
<c>continue</c> is a [[:Category:Keywords|keyword]] statement that causes execution to jump directly to the next iteration of a [[for]] or [[while]] loop. | <c>continue</c> is a [[:Category:Keywords|keyword]] statement that causes execution to jump directly to the next iteration of a [[for]] or [[while]] loop. | ||
| + | See also: [[break]] | ||
| + | |||
| + | == Example == | ||
| + | <ms>s = "I never could get the hang of Thursdays." | ||
| + | result = "" | ||
| + | for c in s | ||
| + | if c == "a" or c == "e" then continue | ||
| + | result = result + c | ||
| + | end for | ||
| + | print result</ms> | ||
| + | |||
| + | '''Output:''' | ||
| + | <pre>I nvr could gt th hng of Thursdys.</pre> | ||
[[Category:Language]] | [[Category:Language]] | ||
[[Category:Keywords]] | [[Category:Keywords]] | ||
| − | |||
| − | |||
Latest revision as of 18:41, 28 May 2022
continue is a keyword statement that causes execution to jump directly to the next iteration of a for or while loop.
See also: break
Example
s = "I never could get the hang of Thursdays."
result = ""
for c in s
if c == "a" or c == "e" then continue
result = result + c
end for
print result
Output:
I nvr could gt th hng of Thursdys.