Jump anywhere: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 2,925: | Line 2,925: | ||
=={{header|VBScript}}== |
=={{header|VBScript}}== |
||
In VBScript, there is no <code>goto</code> statement. It is a good thing for structured programming. |
In VBScript, there is no <code>goto</code> statement. It is a good thing for structured programming. |
||
=={{header|Vlang}}== |
|||
Vlang and 'goto': |
|||
1) 'Goto' used only with 'unsafe' statements. |
|||
2) 'Goto', only allowed unconditionally jumping to a label within the function it belongs to. |
|||
3) Labelled 'break' and 'continue' statements, are preferred alternatives to 'unsafe goto' usage. |
|||
4) Labelled 'break' and 'continue' allow easy breaking out of a nested loop or continuing within a loop. |
|||
<syntaxhighlight lang="vlang"> |
|||
// Unsafe 'goto' pseudo example: |
|||
if x { |
|||
// ... |
|||
if y { |
|||
unsafe { |
|||
goto my_label |
|||
} |
|||
} |
|||
// ... |
|||
} |
|||
my_label: |
|||
// Labelled 'break' and 'continue' example: |
|||
outer: |
|||
for idx := 0; idx < 4; idx++ { |
|||
for jdx := 0; jdx < 4; jdx++ { |
|||
if idx + jdx == 4 {continue outer} |
|||
if idx + jdx == 5 {break outer} |
|||
println(idx + jdx) |
|||
} |
|||
} |
|||
</syntaxhighlight> |
|||
=={{header|VTL-2}}== |
=={{header|VTL-2}}== |