A last big exampleTopAnnouncementsMore exceptions

More exceptions

Here is an example with a different kind of exception:

def myList:List<Number> = list.with(5,7,9)
var index:= 1
try {
  while {index < 7} do {
    print(myList.at(index))
    index := index + 1
  }
} catch {ex:BoundsError ->
  print "went too far!"
  print ("on line {ex.lineNumber} of {ex.moduleName}, {ex.message}")
  // print "\n\nBacktrace: {ex.backtrace}"
}

In this method, the loop terminates when index goes up to four. It then prints out information about what happened.


A last big exampleTopAnnouncementsMore exceptions