@@ -47,6 +47,7 @@ Contents
47
47
* [ Maps as Pseudo Objects for OOP] ( #MapsAsPseudoObjectForOOP )
48
48
* [ Operators] ( #Operators )
49
49
* [ Pseudo-operators] ( #pseudo )
50
+ * [ Expressions] ( #Expressions )
50
51
* [ Subroutines and Functions] ( #SubroutinesAndFunctions )
51
52
* [ Names] ( #SubroutinesAndFunctionsNames )
52
53
* [ Declaration of Subroutines] ( #DeclarationOfSubroutines )
@@ -57,7 +58,7 @@ Contents
57
58
* [ Using Local Variables] ( #UsingLocalVariables )
58
59
* [ Nested Routines] ( #NestedRoutines )
59
60
* [ Declarations in PalmOS] ( #DeclarationsInPalmOS )
60
- * [ Expressions ] ( #Expressions )
61
+ * [ Conditions ] ( #Conditions )
61
62
* [ IF-THEN-ELSIF-ELSE] ( #IfThenElseifEndif )
62
63
* [ Single-line IF-THEN-ELSE] ( #SingleLineIfThenElse )
63
64
* [ Inline Version of IF] ( #InlineVersionOfIf )
@@ -71,12 +72,15 @@ Contents
71
72
* [ Units] ( #Units )
72
73
* [ Declaration] ( #UnitsDeclaration )
73
74
* [ Import] ( #UnitsImport )
75
+ * [ Input and Output] ( #InputAndOutput )
76
+ * [ Print on Screen] ( #PrintOnScreen )
77
+ * [ Read Input from the Keyboard] ( #ReadInputFromKeyboard )
78
+ * [ The USE Keyword] ( #TheUseKeyword )
74
79
* [ OPTION] ( #Statement1 )
75
80
* [ OPTION BASE] ( #Statement2 )
76
81
* [ OPTION MATCH] ( #Statement3 )
77
82
* [ OPTION PREDEF] ( #Statement4 )
78
83
* [ Meta Commands] ( #Meta )
79
- * [ The USE Keyword] ( #TheUseKeyword )
80
84
* [ Exception Handling] ( #ExceptionHandling )
81
85
82
86
:::
100
104
101
105
### Windows {#Windows}
102
106
103
- Download the [ latest release of SmallBASIC] ( https://smallbasic.github.io /pages/download.html) .
107
+ Download the [ latest release of SmallBASIC] ( /pages/download.html ) .
104
108
The different versions of SmallBASIC are included in the zip-file. Extract the zip-file to a
105
109
location of your choice. Open the SmallBASIC folder and start one of the following programs:
106
110
@@ -110,7 +114,7 @@ location of your choice. Open the SmallBASIC folder and start one of the followi
110
114
111
115
### Linux {#Linux}
112
116
113
- Download the [ latest release of SmallBASIC] ( https://smallbasic.github.io/ pages/download.html) .
117
+ Download the [ latest release of SmallBASIC] ( pages/download.html ) .
114
118
The different versions of SmallBASIC are provided as separate AppImages. Download an AppImage
115
119
and copy it to a directory of your choice. Execute the AppImage. Depending of the Linux version
116
120
you have to make the AppImage executable: ` chmod u+x AppImageFile ` , where ` AppImageFile ` is the
@@ -119,7 +123,10 @@ filename of the AppImage.
119
123
### Android {#Android}
120
124
121
125
Download and install SmallBASIC for Android using
122
- [ Google Play] ( https://play.google.com/store/apps/details?id=net.sourceforge.smallbasic ) .
126
+ [ Google Play] ( https://play.google.com/store/apps/details?id=net.sourceforge.smallbasic ) . Files
127
+ are stored in ` /InternalMemory/SmallBASIC ` or in case of an old Android version in
128
+ ` /InternalMemory/Android/data/net.sourceforge.smallbasic/files ` . For easy file transfer between
129
+ Android and desktop, please read [ SmallBASIC file transfer] ( /pages/android_file_transfer.html )
123
130
124
131
### Build from Source {#BuildFromSource}
125
132
@@ -131,9 +138,9 @@ Please follow the instructions on [Github](https://github.com/smallbasic/SmallBA
131
138
132
139
Please read the separate articles for the different versions of SmallBASIC:
133
140
134
- - [ SDL] ( https://smallbasic.github.io /pages/sdl.html)
135
- - [ Android] ( https://smallbasic.github.io /pages/android.html)
136
- - [ FLTK] ( https://smallbasic.github.io /pages/fltk.html)
141
+ - [ SDL] ( /pages/sdl.html )
142
+ - [ Android] ( /pages/android.html )
143
+ - [ FLTK] ( /pages/fltk.html )
137
144
138
145
## Source Code Format {#SourceCodeFormat}
139
146
@@ -1425,7 +1432,7 @@ the select-case structure will be exited and all following case statements will
1425
1432
tested anymore. If non of the case statements were entered the optional 'CASE ELSE'
1426
1433
statements will be entered.
1427
1434
1428
- See function reference [ SELECT CASE] ( https://smallbasic.github.io /reference/655.html) for
1435
+ See function reference [ SELECT CASE] ( /reference/655.html ) for
1429
1436
detailed information.
1430
1437
1431
1438
## Units {#Units}
@@ -1476,6 +1483,62 @@ IMPORT MyUnit as u
1476
1483
u.MyFunction(1)
1477
1484
```
1478
1485
1486
+ ## The USE Keyword {#TheUseKeyword}
1487
+
1488
+ The ` USE ` keyword is used on specific commands for passing a user-defined expression.
1489
+
1490
+ ``` smallbasic
1491
+ SPLIT s," ",v USE TRIM(x)
1492
+ ```
1493
+
1494
+ In this example, every element of ` v ` will be trimmed. Use the ` x ` variable to
1495
+ specify the parameter of the expression. If the expression needs more parameter,
1496
+ you can use also the names ` y ` and ` z ` .
1497
+
1498
+
1499
+ ## Input and Output {#InputAndOutput}
1500
+
1501
+ ### Print on Screen {#PrintOnScreen}
1502
+
1503
+ Use ` PRINT ` to print text on the screen at the current cursor location. When starting
1504
+ the BASIC program, the cursor is in the top left corner. After printing to the screen
1505
+ the cursor location will be updated. After execution of ` PRINT ` , if not otherwise
1506
+ specified, the cursor will be moved to the beginning of the next line. When printing
1507
+ to the last line of the screen, the screen will scroll up by one line.
1508
+
1509
+ Basic usage of ` PRINT ` :
1510
+
1511
+ ``` smallbasic
1512
+ PRINT 1 ' Output: 1
1513
+ PRINT 1+1 ' Output: 2
1514
+ PRINT cos(pi) ' Output: -1
1515
+ PRINT "Text" ' Output: Text
1516
+ ```
1517
+
1518
+ If ` ; ` or ` , ` are used as last character of a print command, carriage return/line feed
1519
+ (new line) will be suppressed after printing.
1520
+
1521
+ Please read the language reference of [ PRINT] ( /reference/535.html )
1522
+ for a detailed description. The text cursor can be set using
1523
+ [ LOCATE] ( /reference/530.html ) .
1524
+
1525
+ ### Read Input from the Keyboard {#ReadInputFromKeyboard}
1526
+
1527
+ ` INPUT ` reads text from keyboard and stores it in a variable. ` INPUT ` can print a prompt
1528
+ on screen. After execution of ` INPUT ` the cursor will be moved to the beginning of the
1529
+ next line. ` INPUT ` will block execution of the program until the return-key is pressed.
1530
+
1531
+ Basic usage of ` INPUT ` :
1532
+
1533
+ ``` smallbasic
1534
+ INPUT "How old are you?", age
1535
+ PRINT age
1536
+ ```
1537
+
1538
+ For more information see language reference of [ INPUT] ( /reference/527.html ) .
1539
+ [ INKEY] ( /reference/539.html ) and [ DEFINEKEY] ( /reference/1015.html ) allow to read from
1540
+ a keyboard without blocking the execution of the program.
1541
+
1479
1542
## OPTION {#Statement1}
1480
1543
1481
1544
The ` OPTION ` command is used to pass parameters to the SB-environment. There are
@@ -1548,18 +1611,6 @@ SmallBASIC uses the following meta commands:
1548
1611
#unit-path: C:\sbasic\units;C:\temp
1549
1612
```
1550
1613
1551
- ### The USE Keyword {#TheUseKeyword}
1552
-
1553
- The ` USE ` keyword is used on specific commands for passing a user-defined expression.
1554
-
1555
- ``` smallbasic
1556
- SPLIT s," ",v USE TRIM(x)
1557
- ```
1558
-
1559
- In this example, every element of ` v ` will be trimmed. Use the ` x ` variable to
1560
- specify the parameter of the expression. If the expression needs more parameter,
1561
- you can use also the names ` y ` and ` z ` .
1562
-
1563
1614
## Exception Handling {#ExceptionHandling}
1564
1615
1565
1616
Exception handling is supported for file handling, and accessing serial ports and
0 commit comments