Loops/Continue: Difference between revisions

+Icon+Unicon
(+Icon+Unicon)
Line 255:
ENDIF
ENDDO </lang>
 
== Icon and Unicon ==
The Icon and Unicon reserved word for 'continue' is 'next'.
==={{header|Icon}}===
The following code demonstrates the use of 'next':
<lang Icon>procedure main()
every writes(x := 1 to 10) do {
if x % 5 = 0 then {
write()
next
}
writes(", ")
}
end</lang>
However, the output sequence can be written without 'next' and far more succinctly as:
<lang Icon>every writes(x := 1 to 10, if x % 5 = 0 then "\n" else ", ")
</lang>
==={{header|Unicon}}===
The Icon solution works in Unicon.
 
=={{header|J}}==
Line 279 ⟶ 298:
 
Though it's rare to see J code like this.
 
 
 
=={{header|Java}}==
Anonymous user