diff --git a/_build/pages/android.markdown b/_build/pages/android.markdown index f742cab0..53b0ed42 100644 --- a/_build/pages/android.markdown +++ b/_build/pages/android.markdown @@ -3,9 +3,23 @@ Android > SmallBASIC for Android guide +The Android version of SmallBASIC comes with a built-in Integrated Development Environment +(IDE), you can write programs on your Android-powered tablet or mobile phone and run them instantly. + ## Getting started -The system menu is accessed by the "three vertical dots" button in the bottom right corner of the screen. +In the video below the basic steps of creating a file, opening it in the internal editor and executing +the program are shown. + +
+ +
+ +Please note, that at the first start of the Android version of SmallBASIC, the editor is turned off. A tap on +a program name will start it immediately. If you want to edit the file, please turn on the editor by tapping +on the three dots in the lower right corner and choosing the entry `Editor [OFF]` to enable the editor. + +## Step-by-Step Guide ![](/images/android_menu1.png "System Menu button") diff --git a/_build/pages/guide.markdown b/_build/pages/guide.markdown index 1f12d65f..58eb3f02 100644 --- a/_build/pages/guide.markdown +++ b/_build/pages/guide.markdown @@ -11,6 +11,13 @@ syntax. Contents ::: +* [Getting Started](#GettingStarted) + * [SmallBASIC Versions](#SmallbasicVersions) + * [Windows](#Windows) + * [Linux](#Linux) + * [Android](#Android) + * [Build from Source](#BuildFromSource) + * [Using the IDE](#UsingtheIntegratedDevelopmentEnvironment) * [Source Code Format](#SourceCodeFormat) * [Comments](#Comments) * [Numbers and Srings](#NumberAndStrings) @@ -37,6 +44,7 @@ Contents * [Accessing Elements of a Map Variable](#AccessingElementsOfAMapVariable) * [Add Key-Value Pairs](#AddKeyValuePairs) * [Key-Value Pairs with References](#KeyValuePairsWithReferences) + * [Maps as Pseudo Objects for OOP](#MapsAsPseudoObjectForOOP) * [Operators](#Operators) * [Pseudo-operators](#pseudo) * [Subroutines and Functions](#SubroutinesAndFunctions) @@ -50,11 +58,16 @@ Contents * [Nested Routines](#NestedRoutines) * [Declarations in PalmOS](#DeclarationsInPalmOS) * [Expressions](#Expressions) + * [IF-THEN-ELSIF-ELSE](#IfThenElseifEndif) + * [Single-line IF-THEN-ELSE](#SingleLineIfThenElse) + * [Inline Version of IF](#InlineVersionOfIf) + * [SELECT CASE](#SelectCase) * [Loops](#Loops) * [FOR-TO-NEXT Loop](#ForToNextLoop) * [FOR-IN-NEXT Loop](#ForInNextLoop) * [WHILE-WEND Loop](#WhileWendLoop) * [REPEAT-UNTIL Loop](#RepeatUntilLoop) + * [The DO Keyword](#TheDoKeyword) * [Units](#Units) * [Declaration](#UnitsDeclaration) * [Import](#UnitsImport) @@ -63,12 +76,65 @@ Contents * [OPTION MATCH](#Statement3) * [OPTION PREDEF](#Statement4) * [Meta Commands](#Meta) -* [The USE keyword](#use) -* [The DO keyword](#do) -* [Loops and variables](#Loops) +* [The USE Keyword](#TheUseKeyword) +* [Exception Handling](#ExceptionHandling) ::: +## Getting Started {#GettingStarted} + +SmallBASIC is available for various operating systems, including +Windows, Linux, and Android. It can be built from source to run +on many other POSIX-compliant systems, such as Raspberry Pi OS. With +its built-in Integrated Development Environment (IDE), you can write +programs on your Android-powered tablet or mobile phone and run them +instantly. + +### SmallBASIC Versions {#SmallbasicVersions} + +SmallBASIC comes in three different flavors for the desktop. The SDL version offers a simple but +efficient IDE and is perfect for working with graphics. The FLTK version has a great IDE. The +console version doesn’t offer an IDE and is text-only but works perfect with plugins like raylib +or nuklear. The Android version is similar to the SDL version and comes with an integrated IDE, +too. + +### Windows {#Windows} + +Download the [latest release of SmallBASIC](https://smallbasic.github.io/pages/download.html). +The different versions of SmallBASIC are included in the zip-file. Extract the zip-file to a +location of your choice. Open the SmallBASIC folder and start one of the following programs: + +- sbasicg.exe: SDL +- sbasici.exe: FLTK +- sbasic.exe: Console + +### Linux {#Linux} + +Download the [latest release of SmallBASIC](https://smallbasic.github.io/pages/download.html). +The different versions of SmallBASIC are provided as separate AppImages. Download an AppImage +and copy it to a directory of your choice. Execute the AppImage. Depending of the Linux version +you have to make the AppImage executable: `chmod u+x AppImageFile`, where `AppImageFile` is the +filename of the AppImage. + +### Android {#Android} + +Download and install SmallBASIC for Android using +[Google Play](https://play.google.com/store/apps/details?id=net.sourceforge.smallbasic). + +### Build from Source {#BuildFromSource} + +Using Linux it is quite easy to build SmallBASIC from source. This has the advantage, that you +don't need to use AppImages and you can use SmallBASIC on other devices like Raspberry Pi. +Please follow the instructions on [Github](https://github.com/smallbasic/SmallBASIC). + +### Using the Integrated Development Environment {#UsingtheIntegratedDevelopmentEnvironment} + +Please read the separate articles for the different versions of SmallBASIC: + +- [SDL](https://smallbasic.github.io/pages/sdl.html) +- [Android](https://smallbasic.github.io/pages/android.html) +- [FLTK](https://smallbasic.github.io/pages/fltk.html) + ## Source Code Format {#SourceCodeFormat} SmallBASIC files are plain text files in ASCII or UTF-8. A program consists of @@ -776,6 +842,8 @@ sub PrintBold(s) end ``` +### Maps as Pseudo Objects for OOP {#MapsAsPseudoObjectForOOP} + Maps in combination with references can be used to create a pseudo object similar to object-oriented programming. @@ -899,13 +967,13 @@ scope. Subroutine and function names can use any alphanumeric characters, extended characters (ASCII codes 128 - 255 for non-English languages), and the symbol `_`. -The first character of the name cannot be a digit nor a `_`. +The first character of the name cannot be a digit. Subroutine and function names are case-insensitive. ``` -abc(), a_c(), ab2c() -> valid names -1cd(), a$b(), _abc() -> invalid names +abc(), a_c(), ab2c(), _abc() -> valid names +1cd(), a$b() -> invalid names ``` Subroutines and functions can not have the same name as build-in commands. @@ -1254,6 +1322,20 @@ UNTIL index > 10 Use `EXIT` or in case of nested loops `EXIT LOOP` to exit the loop. +### The DO Keyword {#TheDoKeyword} + +This keyword is used to declare single-line commands. It can be used with +`WHILE` and `FOR`-family loops. + +```smallbasic +FOR i = 1 to 10 DO PRINT i +FOR f IN files("*.txt") DO PRINT f +``` + +```smallbasic +WHILE i < 4 DO i++ +``` + ## Conditions {#Conditions} Conditions can be used to branch the program flow depending on the value of @@ -1288,9 +1370,10 @@ on its line. If anything other than a comment follows `THEN` on the same line, SmallBASIC interprets it as a single-line IF-THEN-ELSE construct. IF blocks may be nested. -Instead of `ELSEIF` and `ENDIF`, `ELIF` and `FI` can be used. +Instead of `ELSEIF` and `ENDIF`, `ELIF` and `FI` can be used. Instead of `THEN`, +`DO` can be used, but this is not suggested. -### Single-line IF-THEN-ELSE +### Single-line IF-THEN-ELSE {#SingleLineIfThenElse} ```smallbasic IF expression THEN command1 ELSE command2 @@ -1303,7 +1386,47 @@ Multiple commands can be separated by a colon `:`. If instead of a command a number is specified, it is equivalent to a GOTO command with the specified numeric-label. +### Inline Version of IF {#InlineVersionOfIf} + +```smallbasic +result = IFF (condition, return_value_true, return_value_false) +``` + +The command `IFF` will test the condition `condition`. If `condition` resolves to +`true` then `return_value_true` will be returned otherwise `return_value_false`. + +```smallbasic +x = 4 +ans = IFF(x <= 5, 0, 10) +PRINT ans ' Output: 0 +``` + +See function reference [IFF](https://smallbasic.github.io/reference/638.html) for +more information. + +### SELECT CASE {#SelectCase} + +```smallbasic +SELECT CASE expr + CASE result1 + ' do thinks + CASE result2 + ' do thinks + CASE ELSE + ' do thinks +END SELECT +``` + +`SELECT CASE` offers a more concise syntax to writing successive IF tests. `SELECT CASE` +performs multiple tests on the expression `expr`. If the value of `expr` is equal to +`result1`, the case statement `result1` will be entered and the commands executed. An +unlimited amount of case statements can be used. Once a case statement is fulfilled +the select-case structure will be exited and all following case statements will not be +tested anymore. If non of the case statements were entered the optional 'CASE ELSE' +statements will be entered. +See function reference [SELECT CASE](https://smallbasic.github.io/reference/655.html) for +detailed information. ## Units {#Units} @@ -1425,66 +1548,64 @@ SmallBASIC uses the following meta commands: #unit-path: C:\sbasic\units;C:\temp ``` +### The USE Keyword {#TheUseKeyword} +The `USE` keyword is used on specific commands for passing a user-defined expression. -### The USE keyword {#use} - -This keyword is used on specific commands to passing a user-defined expression. - -``` +```smallbasic SPLIT s," ",v USE TRIM(x) ``` -In that example, every element of V() will be 'trimmed'. -Use the x variable to specify the parameter of the expression. If the expression needs more parameter, you can use also the names y and z +In this example, every element of `v` will be trimmed. Use the `x` variable to +specify the parameter of the expression. If the expression needs more parameter, +you can use also the names `y` and `z`. -### The DO keyword {#do} +## Exception Handling {#ExceptionHandling} -This keyword is used to declare single-line commands. It can be used with WHILE and FOR-family commands. +Exception handling is supported for file handling, and accessing serial ports and +network sockets. Exception handling 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. +```smallbasic +TRY + ' do something +CATCH err + print err + ' do something +END TRY ``` -FOR f IN files("*.txt") DO PRINT f -... -WHILE i < 4 DO i ++ -``` - -Also, it can be used by IF command (instead of THEN), but is not suggested. - - -### Loops and variables {#Loops} - -When we write loops it is much better to initialize the counters on the top of the loop instead of the top of the program or nowhere. - -``` -i = 0 -REPEAT - ... - i = i + 1 -UNTIL i > 10 +```smallbasic +TRY + ' do something +CATCH "Error 1" + ' do something +CATCH "Error 2" + ' do something +END TRY ``` -p.. Initializing variables at the top of the loop can make code more readable. +The `TRY` statement introduces a try/catch block. A try/catch block consist of the +following structure: -## Loops and expressions +`TRY` -``` -FOR-like (loops) commands evaluate both the "destination" and the exit-expression every time. -FOR i=0 TO LEN(FILES("*.txt"))-1 - PRINT i -NEXT -``` +The `TRY` statement starts a block of commands which might create a run-time error. -In that example the 'destination' is the LEN(FILES("*.txt"))-1 For each value of i the destination will be evaluated. That is WRONG but it is supported by BASIC and many other languages. -So, it is much better to be rewritten as +`CATCH [var | expr]` -``` -idest=LEN(FILES("*.txt"))-1 -FOR i=0 TO idest - PRINT i -NEXT -``` +The `CATCH` statement is used to catch a run-time error of one of the commands in +the try-block. + +The `CATCH` statement has two modes. You can supply a variable argument to store the +error string. Alternatively you can supply a string 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. -Of course, it is much faster too. +`END TRY` +The `END TRY` statement marks the end of a try/catch block. +For examples see the language reference [TRY](https://smallbasic.github.io/reference/1425.html). \ No newline at end of file diff --git a/_build/pages/sdl.markdown b/_build/pages/sdl.markdown index 58977c21..90f41c25 100644 --- a/_build/pages/sdl.markdown +++ b/_build/pages/sdl.markdown @@ -1,4 +1,20 @@ -# sbasicg (SDL) +# SmallBASIC SDL Version + +The SDL version of SmallBASIC offers a simple but efficient IDE and is perfect for working with graphics. To start the SDL version please execute: + +- Windows: `sbasicg.exe` +- Linux: `SmallBASIC-SDL_xx.xx-x86_64.AppImage` or `sbasicg` if built from source + +In the video below the basic steps of creating a file, opening it in the internal editor and executing +the program are shown. + +
+ +
+ +Please note, that at the first start of the SDL version of SmallBASIC, the editor is turned off. A mouse click on +a file name will start the program immediately. If you want to edit the file, please turn on the editor by clicking +on the three dots in the lower right corner and choosing the entry `Editor [OFF]` to enable the editor. ## Live mode diff --git a/css/style.css b/css/style.css index fa939f20..f8355cbf 100644 --- a/css/style.css +++ b/css/style.css @@ -758,6 +758,19 @@ a.screenshot { display: inline-block; } +.video-container { + position: relative; + padding-bottom: 56.25%; /* 16:9 */ + height: 0; +} +.video-container iframe { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + /* CSS for syntax highlighting */ pre > code.sourceCode { white-space: pre; position: relative; border:0px;} pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } diff --git a/pages/android.html b/pages/android.html index 61de3504..dff3dfc0 100644 --- a/pages/android.html +++ b/pages/android.html @@ -41,9 +41,22 @@

Android

SmallBASIC for Android guide

+

The Android version of SmallBASIC comes with a built-in Integrated +Development Environment (IDE), you can write programs on your +Android-powered tablet or mobile phone and run them instantly.

Getting started

-

The system menu is accessed by the “three vertical dots” button in -the bottom right corner of the screen.

+

In the video below the basic steps of creating a file, opening it in +the internal editor and executing the program are shown.

+
+ +
+

Please note, that at the first start of the Android version of +SmallBASIC, the editor is turned off. A mouse click on a program name +will start it immediately. If you want to edit the file, please turn on +the editor by clicking on the three dots in the lower right corner and +choosing the entry Editor [OFF] to enable the editor.

+

Step-by-Step Guide

The items displayed depend on whether the file browser, code editor @@ -291,7 +304,7 @@

Privacy Policy Privacy Policy

  • Operators
  • -
  • Expressions
  • +
  • Expressions +
  • Loops
  • Units
  • Meta Commands
  • -
  • The USE keyword
  • -
  • The DO keyword
  • -
  • Loops and variables
  • +
  • The USE Keyword
  • +
  • Exception Handling
  • +

    Getting Started

    +

    SmallBASIC is available for various operating systems, including +Windows, Linux, and Android. It can be built from source to run on many +other POSIX-compliant systems, such as Raspberry Pi OS. With its +built-in Integrated Development Environment (IDE), you can write +programs on your Android-powered tablet or mobile phone and run them +instantly.

    +

    SmallBASIC Versions

    +

    SmallBASIC comes in three different flavors for the desktop. The SDL +version offers a simple but efficient IDE and is perfect for working +with graphics. The FLTK version has a great IDE. The console version +doesn’t offer an IDE and is text-only but works perfect with plugins +like raylib or nuklear. The Android version is similar to the SDL +version and comes with an integrated IDE, too.

    +

    Windows

    +

    Download the latest release +of SmallBASIC. The different versions of SmallBASIC are included in +the zip-file. Extract the zip-file to a location of your choice. Open +the SmallBASIC folder and start one of the following programs:

    + +

    Linux

    +

    Download the latest release +of SmallBASIC. The different versions of SmallBASIC are provided as +separate AppImages. Download an AppImage and copy it to a directory of +your choice. Execute the AppImage. Depending of the Linux version you +have to make the AppImage executable: +chmod u+x AppImageFile, where AppImageFile is +the filename of the AppImage.

    +

    Android

    +

    Download and install SmallBASIC for Android using Google +Play.

    +

    Build from Source

    +

    Using Linux it is quite easy to build SmallBASIC from source. This +has the advantage, that you don’t need to use AppImages and you can use +SmallBASIC on other devices like Raspberry Pi. Please follow the +instructions on Github.

    +

    Using the Integrated +Development Environment

    +

    Please read the separate articles for the different versions of +SmallBASIC:

    +

    Source Code Format

    SmallBASIC files are plain text files in ASCII or UTF-8. A program consists of at least one line of text. Every line is terminated with a @@ -788,6 +860,7 @@

    Key-Value Pairs with sub PrintBold(s) print "\e[1m"; s; "\e[21m" end +

    Maps as Pseudo Objects for OOP

    Maps in combination with references can be used to create a pseudo object similar to object-oriented programming.

    Names
     

    Subroutine and function names can use any alphanumeric characters, extended characters (ASCII codes 128 - 255 for non-English languages), and the symbol _. The first character of the name cannot be -a digit nor a _.

    +a digit.

    Subroutine and function names are case-insensitive.

    -
    abc(), a_c(), ab2c()   -> valid names
    -1cd(), a$b(), _abc()   -> invalid names
    +
    abc(), a_c(), ab2c(), _abc()  -> valid names
    +1cd(), a$b()                  -> invalid names

    Subroutines and functions can not have the same name as build-in commands.

    Declaration of Subroutines

    @@ -1279,18 +1352,26 @@

    REPEAT-UNTIL Loop

    UNTIL index > 10

    Use EXIT or in case of nested loops EXIT LOOP to exit the loop.

    +

    The DO Keyword

    +

    This keyword is used to declare single-line commands. It can be used +with WHILE and FOR-family loops.

    +
    FOR i = 1 to 10 DO PRINT i
    +FOR f IN files("*.txt") DO PRINT f
    +
    WHILE i < 4 DO i++

    Conditions

    Conditions can be used to branch the program flow depending on the value of expressions.

    IF-THEN-ELSIF-ELSE

    -
    IF expression1 THEN
    -  ' some code
    -ELSEIF expression2 THEN
    -  ' some code
    -ELSE
    -  ' some code
    -ENDIF
    +
    IF expression1 THEN
    +  ' some code
    +ELSEIF expression2 THEN
    +  ' some code
    +ELSE
    +  ' some code
    +ENDIF

    IF-THEN_ELSEIF-ELSE causes SmallBASIC to make a decision based on the value of an expression. expression1 and expression2 are expressions, which will be evaluated. @@ -1310,10 +1391,12 @@

    IF-THEN-ELSIF-ELSE

    THEN on the same line, SmallBASIC interprets it as a single-line IF-THEN-ELSE construct. IF blocks may be nested.

    Instead of ELSEIF and ENDIF, -ELIF and FI can be used.

    -

    Single-line IF-THEN-ELSE

    -
    IF expression THEN command1 ELSE command2
    +ELIF and FI can be used. Instead of +THEN, DO can be used, but this is not +suggested.

    +

    Single-line IF-THEN-ELSE

    +
    IF expression THEN command1 ELSE command2

    Single-line IF-THEN-ELSE causes SmallBASIC to make a decision based on the value of an expression expression. 0 is equivalent to FALSE, while all other values are equivalent @@ -1321,6 +1404,42 @@

    Single-line IF-THEN-ELSE

    are any legal commands. Multiple commands can be separated by a colon :. If instead of a command a number is specified, it is equivalent to a GOTO command with the specified numeric-label.

    +

    Inline Version of IF

    +
    result = IFF (condition, return_value_true, return_value_false)
    +

    The command IFF will test the condition +condition. If condition resolves to +true then return_value_true will be returned +otherwise return_value_false.

    +
    x = 4
    +ans = IFF(x <= 5, 0, 10)
    +PRINT ans           ' Output: 0
    +

    See function reference IFF for more +information.

    +

    SELECT CASE

    +
    SELECT CASE expr
    +  CASE result1
    +    ' do thinks
    +  CASE result2
    +    ' do thinks
    +  CASE ELSE
    +    ' do thinks
    +END SELECT
    +

    SELECT CASE offers a more concise syntax to writing +successive IF tests. SELECT CASE performs multiple tests on +the expression expr. If the value of expr is +equal to result1, the case statement result1 +will be entered and the commands executed. An unlimited amount of case +statements can be used. Once a case statement is fulfilled the +select-case structure will be exited and all following case statements +will not be tested anymore. If non of the case statements were entered +the optional ‘CASE ELSE’ statements will be entered.

    +

    See function reference SELECT CASE +for detailed information.

    Units

    Units are a set of subroutines, functions and/or variables that can be used by another SmallBASIC program or SmallBASIC unit. An unit has @@ -1335,14 +1454,14 @@

    Declaration

    file. The functions, subroutines and/or variables which should be accessible by another programs must be declared with the EXPORT keyword and defined in the unit source file.

    -
    UNIT MyUnitName
    -
    -EXPORT MyFunction
    -
    -FUNC MyFuntion(x)
    -  ' some code
    -END
    +
    UNIT MyUnitName
    +
    +EXPORT MyFunction
    +
    +FUNC MyFuntion(x)
    +  ' some code
    +END

    Function, subroutines or variables which are not exported can only be used inside the unit source file.

    Import

    @@ -1353,12 +1472,12 @@

    Import

    IMPORT UnitName AS NameSpace.

    To access a member of a unit use the namespace followed by a point and the name of the member.

    -
    IMPORT MyUnit
    -MyUnit.MyFunction(1)
    -
    IMPORT MyUnit as u
    -u.MyFunction(1)
    +
    IMPORT MyUnit
    +MyUnit.MyFunction(1)
    +
    IMPORT MyUnit as u
    +u.MyFunction(1)

    OPTION

    The OPTION command is used to pass parameters to the SB-environment. There are two styles for that, the run-time which can @@ -1374,10 +1493,10 @@

    OPTION BASE

    Use OPTION BASE 1 to set the index of the first element of an array to 1. This option is useful especially for beginners, because it makes counting elements more intuitive.

    -
    OPTION BASE 1
    -A = [1,2,3]
    -PRINT A[1]    ' Output 1
    +
    OPTION BASE 1
    +A = [1,2,3]
    +PRINT A[1]    ' Output 1

    OPTION BASE is a run-time option.

    OPTION MATCH

    OPTION MATCH [PCRE [CASELESS]|SIMPLE] sets the default @@ -1418,52 +1537,61 @@

    Meta Commands

    up the environment variable SB_UNIT_PATH. Directories on Linux must be separated by :, and on DOS/Windows by ; -
    #!/usr/local/bin/sbasic
    -#inc:"mylib.bas"
    -#unit-path: C:\sbasic\units;C:\temp
    -

    The USE keyword

    -

    This keyword is used on specific commands to passing a user-defined -expression.

    -
    SPLIT s," ",v USE TRIM(x)
    -

    In that example, every element of V() will be ‘trimmed’. Use the x -variable to specify the parameter of the expression. If the expression -needs more parameter, you can use also the names y and z

    -

    The DO keyword

    -

    This keyword is used to declare single-line commands. It can be used -with WHILE and FOR-family commands.

    -
    FOR f IN files("*.txt") DO PRINT f
    -...
    -WHILE i < 4 DO i ++
    -

    Also, it can be used by IF command (instead of THEN), but is not -suggested.

    -

    Loops and variables

    -

    When we write loops it is much better to initialize the counters on -the top of the loop instead of the top of the program or nowhere.

    -
    i = 0
    -REPEAT
    -  ...
    -  i = i + 1
    -UNTIL i > 10
    -

    p.. Initializing variables at the top of the loop can make code more -readable.

    -

    Loops and expressions

    -
    FOR-like (loops) commands evaluate both the "destination" and the exit-expression every time.
    -FOR i=0 TO LEN(FILES("*.txt"))-1
    -    PRINT i
    -NEXT
    -

    In that example the ‘destination’ is the LEN(FILES(“*.txt”))-1 For -each value of i the destination will be evaluated. That is WRONG but it -is supported by BASIC and many other languages. So, it is much better to -be rewritten as

    -
    idest=LEN(FILES("*.txt"))-1
    -FOR i=0 TO idest
    -    PRINT i
    -NEXT
    -

    Of course, it is much faster too.

    +
    #!/usr/local/bin/sbasic
    +#inc:"mylib.bas"
    +#unit-path: C:\sbasic\units;C:\temp
    +

    The USE Keyword

    +

    The USE keyword is used on specific commands for passing +a user-defined expression.

    +
    SPLIT s," ",v USE TRIM(x)
    +

    In this example, every element of v will be trimmed. Use +the x variable to specify the parameter of the expression. +If the expression needs more parameter, you can use also the names +y and z.

    +

    Exception Handling

    +

    Exception handling is supported for file handling, and accessing +serial ports and network sockets. Exception handling 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.

    +
    TRY
    +    ' do something
    +CATCH err
    +    print err
    +    ' do something
    +END TRY
    +
    TRY
    +    ' do something
    +CATCH "Error 1"
    +    ' do something
    +CATCH "Error 2"
    +    ' do something
    +END TRY
    +

    The TRY statement introduces a try/catch block. A +try/catch block consist of the following structure:

    +

    TRY

    +

    The TRY statement starts a block of commands which might +create a run-time error.

    +

    CATCH [var | expr]

    +

    The CATCH statement is used to catch a run-time error of +one of the commands in the try-block.

    +

    The CATCH statement has two modes. You can supply a +variable argument to store the error string. Alternatively you can +supply a string 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.

    +

    END TRY

    +

    The END TRY statement marks the end of a try/catch +block.

    +

    For examples see the language reference TRY.

    -

    sbasicg (SDL)

    +

    SmallBASIC SDL Version

    +

    The SDL version of SmallBASIC offers a simple but efficient IDE and +is perfect for working with graphics. To start the SDL version please +execute:

    + +

    In the video below the basic steps of creating a file, opening it in +the internal editor and executing the program are shown.

    +
    + +
    +

    Please note, that at the first start of the SDL version of +SmallBASIC, the editor is turned off. A mouse click on a file name will +start the program immediately. If you want to edit the file, please turn +on the editor by clicking on the three dots in the lower right corner +and choosing the entry Editor [OFF] to enable the +editor.

    Live mode

    Live mode uses a secondary output window to display the results of your program whenever you press save.

    @@ -170,7 +190,7 @@

    How to 16 - row_marker