summary refs log blame commit diff stats
path: root/tests/exception/texceptionbreak.nim
blob: 00dd8ed9fcd325fb5198b43c5aac07cfb401ab8f (plain) (tree)
1
2
3
4
5
6
7
8
9






                          

                                        



                     
                 




                

                                        








                     

                                        







                

                                          

         
        
discard """
  file: "tnestedbreak.nim"
  output: "1\n2\n3\n4"
"""

# First variety
try:
  raise newException(OSError, "Problem")
except OSError:
  for y in [1, 2, 3]:
    discard
  try:
    discard
  except OSError:
    discard
echo "1"

# Second Variety
try:
  raise newException(OSError, "Problem")
except OSError:
  for y in [1, 2, 3]:
    discard
  for y in [1, 2, 3]:
    discard

echo "2"

# Third Variety
try:
  raise newException(OSError, "Problem")
except OSError:
  block:
    break

echo "3"

# Fourth Variety
block:
  try:
    raise newException(OSError, "Problem")
  except OSError:
    break

echo "4"