You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/language_support_kdekate.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -74,7 +74,7 @@ <h2 id="setup-syntax-highlighting-and-coloring">Setup Syntax Highlighting and Co
74
74
<p>Copy the file “smallbasic.xml” into the folder “~/.local/share/org.kde.syntax-highlighting/syntax/”. Most probably this folder does not exist. Please create it. Restart Kate and chose “SmallBASIC” for highlighting.</p>
75
75
</div>
76
76
<divclass="pagefooter">
77
-
This page was last edited on Tue, 22 Aug 2023 22:33:13 +0200
77
+
This page was last edited on Thu, 24 Aug 2023 08:14:54 +0930
<li><ahref="http://www.bitsavers.org/pdf/dartmouth/BASIC_Oct64.pdf" target="_blank">Dartmouth BASIC spec circa 1964</a></li>
86
83
</ul>
87
84
<h2id="what-about-the-other-smallbasic">What about the other “SmallBASIC?”</h2>
88
-
<p>We noticed there’s another version of <ahref="http://smallbasic.com/faq.aspx" target="_blank">SmallBASIC</a>. Other than the naming coincidence, our version of SmallBASIC doesn’t have anything to do with this other version.</p>
89
-
<ul>
90
-
<li><ahref="http://sb-translator.appspot.com/" target="_blank">Small Basic to SmallBASIC translator - experimental</a></li>
91
-
</ul>
85
+
<p>We noticed there’s another version of <ahref="https://smallbasic-publicwebsite.azurewebsites.net" target="_blank">SmallBASIC</a>. Other than the naming coincidence, our version of SmallBASIC doesn’t have anything to do with this other version.</p>
Copy file name to clipboardExpand all lines: reference/1425.html
+29-15Lines changed: 29 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -73,28 +73,48 @@ <h1>TRY</h1>
73
73
<ahref="/pages/language.html">Language</a>
74
74
</p>
75
75
</div>
76
+
<p>The TRY statement introduces a TRY/CATCH block. A try/catch block consist of the following structure:</p>
76
77
<p><strong>TRY</strong></p>
77
-
<p>The TRY statement introduces a TRY/CATCH block.</p>
78
+
<p>The TRY statement starts a block of commands which might create a run-time error.</p>
78
79
<p><strong>CATCH [var | expr]</strong></p>
79
-
<p>The CATCH statement is used to CATCH an run-time error. This is typically used with errors raised when calling a file system command that cannot be completed, for example attempting to open a non-existent file.</p>
80
-
<p>The CATCH statement has two modes. You can supply a variable argument to store the error string. Alternatively you can supply an expression. When the raised error matches the (String) expression, the error will be caught.</p>
81
-
<p>When using the expression mode, you can supply a succession of CATCH statements to handle various error messages separately.</p>
80
+
<p>The CATCH statement is used to catch a run-time error of one of the commands in the try-block. This is typically used with errors raised when calling a file system command that cannot be completed, for example attempting to open a non-existent file.</p>
81
+
<p>The CATCH statement has two modes. You can supply a variable argument to store the error string. Alternatively you can supply an expression. When the raised error matches the (String) expression, the error will be caught. When using the expression mode, you can supply a succession of CATCH statements to handle various error messages separately.</p>
82
82
<p><strong>END TRY</strong></p>
83
83
<p>The END TRY statement marks the end of a TRY/CATCH block.</p>
84
84
<h3id="example-1-opening-a-non-existing-file-for-reading">Example 1: Opening a non-existing file for reading</h3>
85
85
<pre><code>try
86
86
' DON'T use existing file for demo.
87
87
open "try demo.tmp" for input as #1
88
88
catch err
89
-
print err; " "
89
+
print err
90
90
' Some error handling could be implemented here
91
91
' i.e: if(err = "...") then ...
92
92
end try
93
93
94
94
print "This point is reach, even if opening the file was not possible"</code></pre>
95
-
<h3id="example-2-advanced-error-handling-for-opening-files">Example 2: Advanced error handling for opening files</h3>
96
-
<pre><code>
97
-
' See also: Home -- Articles -- TRY / CATCH
95
+
<h3id="example-2-open-com-port">Example 2: Open COM-Port</h3>
96
+
<pre><code>try
97
+
open "com2000:" AS #1
98
+
catch err
99
+
print "open failed: ";err
100
+
end try</code></pre>
101
+
<h3id="example-3-using-error-expressions">Example 3: Using error expressions</h3>
102
+
<pre><code>try
103
+
' DON'T use existing file for demo.
104
+
open "demo.tmp" for input as #1 ' Replace "demo.tmp" by "?.tmp"
105
+
catch "FS(2): NO SUCH FILE OR DIRECTORY"
106
+
print "File not found"
107
+
' Some error handling could be implemented here
108
+
goto aftertrycatch
109
+
catch "FS(22): INVALID ARGUMENT"
110
+
print "Filename not allowed"
111
+
' Some error handling could be implemented here
112
+
end try
113
+
114
+
label aftertrycatch
115
+
print "end of program"</code></pre>
116
+
<h3id="example-4-advanced-error-handling-for-opening-files">Example 4: Advanced error handling for opening files</h3>
117
+
<pre><code>' See also: Home -- Articles -- TRY / CATCH
98
118
Const FILE_NAME = "try demo.tmp" ' -- DON'T use existing file for demo.
Copy file name to clipboardExpand all lines: reference/1426.html
+14-3Lines changed: 14 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -73,9 +73,20 @@ <h1>CATCH</h1>
73
73
<ahref="/pages/language.html">Language</a>
74
74
</p>
75
75
</div>
76
-
<p>The CATCH statement is used to CATCH a run-time error. This is typically used with errors raised when calling a file system command that cannot be completed, for example attempting to open a non-existent file.</p>
76
+
<p>The CATCH statement is used to catch a run-time error. This is typically used with errors raised when calling a file system command that cannot be completed, for example attempting to open a non-existent file.</p>
77
77
<p>The CATCH statement has two modes. You can supply a variable argument to store the error string. Alternatively you can supply an expression. When the raised error matches the (String) expression, the error will be caught. When using the expression mode, you can supply a succession of CATCH statements to handle various error messages separately.</p>
78
-
<p>For more information and examples please see TRY.</p>
78
+
<p>For more information see TRY.</p>
79
+
<h3id="example">Example</h3>
80
+
<pre><code>try
81
+
' DON'T use existing file for demo.
82
+
open "try demo.tmp" for input as #1
83
+
catch err
84
+
print err
85
+
' Some error handling could be implemented here
86
+
' i.e: if(err = "...") then ...
87
+
end try
88
+
89
+
print "This point is reach, even if opening the file was not possible"</code></pre>
79
90
<divclass="lavenderBox">
80
91
<divclass="header">Code samples using CATCH</div>
81
92
<divclass="linklist">
@@ -178,7 +189,7 @@ <h1>CATCH</h1>
178
189
</div>
179
190
</div>
180
191
<divclass="pagefooter">
181
-
This page was last edited on Sat, 17 Dec 2022 17:21:18 +0100
192
+
This page was last edited on Wed, 6 Sep 2023 18:17:39 +0200
Copy file name to clipboardExpand all lines: reference/1437.html
+11-19Lines changed: 11 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -73,25 +73,17 @@ <h1>THROW</h1>
73
73
<ahref="/pages/language.html">Language</a>
74
74
</p>
75
75
</div>
76
-
<p>The THROW command (previously known as RTE) is used to initiate a catch-able error. If there is no surrounding TRY/CATCH block, THROW can be used to abort the program.</p>
77
-
<p><em>Summary</em> TRY/CATCH is used to trap errors allowing a program to recover without having to be restarted.</p>
78
-
<pre><code>TRY</code></pre>
79
-
<p>The TRY statement introduces a TRY/CATCH BLOCK.</p>
80
-
<pre><code>CATCH [var | expr]</code></pre>
81
-
<p>The CATCH statement is used to CATCH an run-time error. This is typically used with errors raised when calling a file system command that cannot be completed, for example attempting to open a non-existent file.</p>
82
-
<p>The CATCH statement has two modes. You can supply a variable argument to store the error string. Alternatively you can supply an expression. When the raised error matches the (String) expression, the error will be caught.</p>
83
-
<p>When using the expression mode, you can supply a succession of CATCH statements to handle various error messages separately. END TRY</p>
84
-
<p>The END TRY statement marks the end of a TRY/CATCH block.</p>
85
-
<pre><code>THROW</code></pre>
86
-
<p>The THROW command (previously known as RTE) is used to initiate a catch-able error. If there is no surrounding TRY/CATCH block, THROW can be used to abort the program.</p>
87
-
<p>Example</p>
88
-
<pre><code>
89
-
try
90
-
open "com2000:" AS #1
76
+
<p>The THROW command is used to initiate a catch-able error. If there is no surrounding TRY/CATCH block, THROW can be used to abort the program. Optional a string <code>info</code> can be used to create an error message.</p>
77
+
<h3id="example-1-abort-a-program">Example 1: Abort a program</h3>
78
+
<pre><code>throw("Error")</code></pre>
79
+
<h3id="example-2-initial-a-catch-able-error">Example 2: Initial a catch-able error</h3>
80
+
<pre><code>try
81
+
a = 1
82
+
if(a == 1) then throw("a == 1")
83
+
if(a == 2) then throw("a == 2")
91
84
catch err
92
-
? "in catch: open failed";err
93
-
end try
94
-
</code></pre>
85
+
print "Error: "; err
86
+
end try</code></pre>
95
87
<divclass="lavenderBox">
96
88
<divclass="header">Code samples using THROW</div>
97
89
<divclass="linklist">
@@ -195,7 +187,7 @@ <h1>THROW</h1>
195
187
</div>
196
188
</div>
197
189
<divclass="pagefooter">
198
-
This page was last edited on Thu, 22 Mar 2018 20:09:41 +1000
190
+
This page was last edited on Fri, 1 Sep 2023 15:59:38 +0200
0 commit comments