The Queue:
Reformatting/regeneration ...
MRU: 09/03/05
Navigation
Index

About Me

Guestbook

Portfolio

Tutorials

Contact



Bunnie.net
The Enhanced OnePlus1 Program
     When you ran the OnePlus1 program, it didn't stop unless you forced it to stop. In this lesson, we will use the If and If...Then...End statements; we will modify the code to set a point where the program will stop on its own. Modify the code so that it looks like the code below.

:ClrHome
:Lbl 0
:0->X
:Lbl 1
:While 10
:Output(1,1,"1+1="
:Output(1,5,X
:X+1->X
:If X=25
:Output(2,1,"ALMOST DONE"
:If X=50
:Then
:Output(3,1,"DONE."
:Stop
:End
:Goto 1


     Run the program and follow its actions. When X is equal to 25, the program displays the text "ALMOST DONE." This is done using the If statement. The If statement allows one to define a condition such as when X=25, and then run a single command such as Output(2,1,"ALMOST DONE". This can be very useful in the termination (stop) of your program; we will use this with the Getkey command later. When X is equal to 50, the program displays a message and then ends. This is done using an If...Then...End statement. One starts off by defining the condition with If (If X=50), then telling the calculator what to do next with Then, list some commands, and then end the If...Then...End statement with End. (Note: This statement supports the execution of many commands with only one If statement.) One may also use the Else command inside of the If...Then...End statement like so: If...Then...Else...End. The Else command acts when the requirements for the If command are not fulfilled. We will use this later on.
Tutorial Contents
Index
Introduction
The HELLO Program
Enhancing the HELLO Program
The ONEPLUS1 Program
The Enhanced ONEPLUS1 Program
The MENU Program
The BOUNCE Program
The MOVEMENT Program
Other Helpful Info
 
 
 All content: © Bryan Aller 2005-2006