Category:Palo Alto Tiny BASIC: Difference between revisions
Content added Content deleted
(Features and links to implementations (and I am tired of Palo Alto Tiny BASIC).) |
(→Features: RND; separating print items; setting widths of print items.) |
||
Line 16: | Line 16: | ||
* Numeric results of compare operations: 1 (if true), 0 (if false). Thus, one can use them in arithmetic expression. Note: <syntaxhighlight lang="basic">LET A=B=0</syntaxhighlight> means "set <code>A</code> to the result of comparing <code>B</code> with 0". |
* Numeric results of compare operations: 1 (if true), 0 (if false). Thus, one can use them in arithmetic expression. Note: <syntaxhighlight lang="basic">LET A=B=0</syntaxhighlight> means "set <code>A</code> to the result of comparing <code>B</code> with 0". |
||
* A prompt in an <code>INPUT</code> command. If the prompt is omitted, the default is a name of the variable. E.g. <syntaxhighlight lang="basic">INPUT "WHAT IS THE HEIGHT"H</syntaxhighlight> will print <code>WHAT IS THE HEIGHT:</code> and wait to read an expression from the input device.<syntaxhighlight lang="basic">INPUT H</syntaxhighlight> will print <code>H:</code> and so on. |
* A prompt in an <code>INPUT</code> command. If the prompt is omitted, the default is a name of the variable. E.g. <syntaxhighlight lang="basic">INPUT "WHAT IS THE HEIGHT"H</syntaxhighlight> will print <code>WHAT IS THE HEIGHT:</code> and wait to read an expression from the input device.<syntaxhighlight lang="basic">INPUT H</syntaxhighlight> will print <code>H:</code> and so on. |
||
* The function <code>RND(X)</code> that returns a random number between 1 and X (inclusive). |
|||
* Separating print items with <code>,</code> (comma). |
|||
* Setting widths of numeric print items. A number preceeded by <code>#</code> sets the width (6 by default) of following numeric print items. It does not count leading spaces. For example, |
|||
<syntaxhighlight lang="basic"> |
|||
10 PRINT "X",#2,1,10,"X" |
|||
20 PRINT 1,#4,10,20,#2,30,40 |
|||
</syntaxhighlight> |
|||
displays |
|||
<pre> |
|||
X 1 10X |
|||
1 10 20 30 40 |
|||
</pre> |
|||
==Implementations== |
==Implementations== |