Description:
Try to continue with the execution of a code block by ignoring the error.
Syntax:
try
Note:
The statement tries to continue with the execution of a code block. It logs an error if there is one and goes on with the execution. The program will terminate if the statement isn’t used.
Example:
|
A |
B |
C |
D |
|
1 |
try |
|
|
|
Use try statement to try to go on with the execution of the code block. |
2 |
|
[1,2,3,4,5] |
=[] |
|
C2 returns a sequence of [1,2]. |
3 |
|
for B2 |
|
|
|
4 |
|
|
if B3>2 |
|
|
5 |
|
|
|
>C2=C2+B3 |
The program reports an error at D5, logs it and goes on with the execution. |
6 |
|
|
else |
|
|
7 |
|
|
|
>C2=C2|B3 |
|