Introduction to Casio BASIC
Casio BASIC
PART 1: Creating a Program
To create a new program press  then locate the program icon, press , press  to create a new program. You will then be asked to enter a name for your program, also you may create a password at this time (WARNING: if you put a password on your program you will not be able to use the debugger).
离去背影PART 2: Variable Basics
A variable is something which holds a value. The most commonly used are the letters A~Z and r,_. There are others, but they are not covered in this section. To store a value into a variable you must use the  key, like this:
CODE
1->A  // Assigns 1 to A
It should look like this:
胡歌新歌
CODE
1->A~D // Assigns 1 to A B C & D
Variables are the most important aspect of programming.
PART 3: Basic Loops
Loops are used to repeat blocks of code. There are several types of loops in Casio BASIC: Goto/Lbl, Do/lpWhle, For/Next, and While/WhileEnd. Here is an example of a Goto/Lbl loop:
CODE
1->A  //Assigns 1 to A
Lbl 1
切斯克劳福A+1->A  //Adds 1 to the variable A and stores new value
Goto 1  //Returns to Lbl 1
This loop will execute infinitely, Adding 1 to A each time (actually it will stop when the value of A is greater than 99*10^99 because you will get a mem error).
Here is an example of a For loop; note that it does not take as many lines:
CODE
For 1->A to 100 Step 1
//this loop assigns 1 to A then adds 1 to A until it equals 100
Next //Goes back to the start of the loop, adds the step to the variable.
Anything between the For and next statement will be executed until the expression evaluates true (A equals 100). By changing the value of Step you can change how much A is incremented by.
The While loop checks to see if the expression is true then executes the code. After the code has been executed it returns to the top, checks the expression, and if it is false jumps out of the loop and continues with executing the program. This is an example of a While loop.
CODE
1->A
While 1=1 //1 always equals 1 so the expression always evaluates to True
A+1->A
WhileEnd
Since the while loop evaluates the expression before executing the code it is possible that if the expression is false before loop begins (ex: 1=2) then the loop will never occur, it will just skip right over the code and continue with the program.
Unlike a while loop a Do/LpWhle loop will always execute at least once since it evaluates the expression after the code has been executed. A Do/LpWhle loop looks like this.
CODE
1->A
Do  //Start of the Do/LpWhle loop
A+1->A
LpWhle A<100 //Loops while A is less than 100
袁立为什么是劣迹艺人
PART 4: Selection Statements
Selection Statements are used to make programs have differing outcomes, instead to executing the same way every time they are run. A selection statement checks an expression, sees if it is True or False, then if True executes the rest of the statement otherwise it skips to below the statement and continues with execution. There are two types of selection statements on the calculator. They are the If/Else statement and the => arrow.
An If/Else statement works like this
CODE
1->A
If A=1  //expression to be evaluated
Then “HI”  //result if expression is true
“HOW ARE YOU”
Else “BYE”  //result if expression is false
“SEE YOU LATER”
If End  //end of statement
Result:卓越吉他手
Since A is 1 the statement evaluates to true, therefore
QUOTE (Program Output)
HI
披头四HOW ARE YOU
is printed. If you replaced the first line with 0->A then the if statement would evaluate to False, and
QUOTE (Program output)
BYE
SEE YOU LATER
would be printed.
An If statement can contain many different things, and can be many lines long, they are the keystone to making a game, and before going on you should feel comfortable using them.
The => arrow is also very useful, it is a single line selection statement that takes up less space but can do less than a normal if/else.
This is the same code as above, except using the => arrow instead of the If statement.
CODE
1->A
A=1=>”HI”
A=1=>“HOW ARE YOU”
A<>1=>”BYE”  // <> means not equal to
A<>1=>”SEE YOU LATER”
In general, the best time to use a if statement is when you have at least two lines of code to be put inside, otherwise use the => arrow.
PART 5: Advanced Loops
Nesting is when you take one loop and put it inside another. Here is an example: CODE
0->C
For 1->A To 10  //Step can be omitted instead of using Step 1
For 1->B To 10
A+B+C->C
Next
Next
C represents the output sign, it displays whatever is before it and Pauses until [EXE] is pressed.
By executing this code you will get this output:
QUOTE (Program Output)
1100//caused by