CASIO BASIC

from Wikipedia, the free encyclopedia

CASIO BASIC is the unofficial name of a programming language that can be used to program various mini-programs for pocket calculators from Casio . CASIO BASIC is a dialect of Basic .

programming

In addition to direct input on the calculator, the programs can also be edited externally on the computer with various additional programs and then transferred to the calculator via data cable. Commands are separated by a paragraph or a colon.

variables

In contrast to other programming languages, the variable identifier ( variable ) in CASIO BASIC consists of just one letter. Thus, the number of variables that can be used in a program is just over 26. Since some mathematical symbols can also be used as variables, the exact number of variables varies from model to model. In addition, one and two-dimensional fields (list, matrix) can be used.

Values ​​are assigned to variables with the "→" operator.

Entries of numbers are transferred to a variable with the following command:

  • 4 → A

Values ​​query from the program user:

  • ? → B

Key press query

The “Getkey” command can be used to query the key code of the key currently pressed. Every button - except for AC / On / Off - has one. If no keys are pressed, the return value 0 and EXIT 47 are returned. It is advisable to write a program which outputs the current key code in order to develop the codes for programming yourself.

A simplified example of use:

  • Short program that moves a ball to the left and right using the arrow keys.
While Getkey ≠ 47
Locate x,y," "
Getkey=27 ⇒ X<21 ⇒ x+1→x
Getkey=38 ⇒ X>1 ⇒ x-1→x
Locate x,y,"O"
WhileEnd

conditions

  • If ... Then ... IfEnd statement
If Bedingung
Then
<Anweisung(en)>
IfEnd
  • If ... Then ... Else ... IfEnd statement
If Bedingung
Then
<Anweisung(en)>
Else
<Anweisung>
IfEnd
  • alternative / shortened If ... Then statement
BedingungAnweisung

grind

  • For ... To ... Next
For WertVariable
To Wert
<Anweisung(en)>
Next
  • For ... To ... Step ... Next
For VariableWert
To Wert
Step Wert
<Anweisung(en)>
Next
  • While ... WhileEnd
While Bedingung
<Anweisung(en)>
WhileEnd
  • Thu ... LpWhile
Do 
<Anweisung(en)>
LpWhile Bedingung

Text output

"Hallo Welt"
(schreibt als fortlaufenden Text auf dem Textbildschirm, schiebt vorherige Texteingaben nach oben)

Or:

Locate X,Y,"Hallo Welt"
(schreibt an angegebene Koordinaten auf dem Textbildschirm, überschreibt darunter liegenden Text, Koordinaten werden in Zeichen gemessen)

Or:

Text Y,X,"Hallo Welt"
(schreibt den genannten Text sehr klein auf den Grafikbildschirm,  Koordinaten werden in Pixel auf dem Grafikbildschirm gemessen)