User Tools

Site Tools


structured_20exception_20handling

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
structured_20exception_20handling [2018/04/17 19:00]
tbest3112 Added syntax highlighting
structured_20exception_20handling [2020/06/05 21:40] (current)
richardrussell
Line 12: Line 12:
     }     }
 </​code>​ </​code>​
-The **try** clause contains the code you want to execute, which may consist of any number of statements and may optionally call subroutines. This is the code that you anticipate //might// result in an error being generated. The **catch** clause contains the code you want to be executed if an error occurs whilst executing the **try** clause. Whether or not an error occurs, execution continues normally after the **catch** clause.\\ \\  BBC BASIC does not natively provide such a facility, but in //BBC BASIC for Windows// you can emulate the behaviour quite easily as follows:\\ \\ +The **try** clause contains the code you want to execute, which may consist of any number of statements and may optionally call subroutines. This is the code that you anticipate //might// result in an error being generated. The **catch** clause contains the code you want to be executed if an error occurs whilst executing the **try** clause. Whether or not an error occurs, execution continues normally after the **catch** clause.\\ \\  BBC BASIC does not natively provide such a facility, but in //BBC BASIC for Windows// and //BBC BASIC for SDL 2.0// you can emulate the behaviour quite easily as follows:\\ \\ 
 <code bb4w> <code bb4w>
         ON ERROR LOCAL IF FALSE THEN         ON ERROR LOCAL IF FALSE THEN
structured_20exception_20handling.txt ยท Last modified: 2020/06/05 21:40 by richardrussell