mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
45 lines
579 B
Nim
45 lines
579 B
Nim
discard """
|
|
file: "tnestedbreak.nim"
|
|
output: "1\n2\n3\n4"
|
|
"""
|
|
|
|
# First variety
|
|
try:
|
|
raise newException(EOS, "Problem")
|
|
except EOS:
|
|
for y in [1, 2, 3]:
|
|
discard
|
|
try:
|
|
discard
|
|
except EOS:
|
|
discard
|
|
echo "1"
|
|
|
|
# Second Variety
|
|
try:
|
|
raise newException(EOS, "Problem")
|
|
except EOS:
|
|
for y in [1, 2, 3]:
|
|
discard
|
|
for y in [1, 2, 3]:
|
|
discard
|
|
|
|
echo "2"
|
|
|
|
# Third Variety
|
|
try:
|
|
raise newException(EOS, "Problem")
|
|
except EOS:
|
|
block:
|
|
break
|
|
|
|
echo "3"
|
|
|
|
# Fourth Variety
|
|
block:
|
|
try:
|
|
raise newException(EOS, "Problem")
|
|
except EOS:
|
|
break
|
|
|
|
echo "4" |