summary refs log blame commit diff stats
path: root/tests/exception/texceptionbreak.nim
blob: 76e986787f3d94945c9aa4edb4541e9a70ff9e6e (plain) (tree)












































                                      
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"