This shows you the differences between two versions of the page.
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] 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 |