EasyManuals Logo

Parallax Boe-Bot User Manual

Parallax Boe-Bot
360 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #86 background imageLoading...
Page #86 background image
Page 72 · Robotics with the Boe-Bot
Default Value - If you do not initialize a variable, the program will automatically start by
storing the number zero in that variable. That’s called the variable's default value.
The “=” sign in value = 500 is an example of an operator. You can use other operators
to do math with variables. Here are a couple of multiplication examples:
value = 10 * value
anotherValue = 2 * value
Example Program: VariablesAndSimpleMath.bs2
This program demonstrates how to declare, initialize, and perform operations on
variables.
Before running the program, predict what each
DEBUG command will display.
Enter, save, and run VariablesAndSimpleMath.bs2.
Compare the results to your predictions and explain any differences.
' Robotics with the Boe-Bot - VariablesAndSimpleMath.bs2
' Declare variables and use them to solve a few arithmetic problems.
' {$STAMP BS2}
' {$PBASIC 2.5}
value VAR Word ' Declare variables
anotherValue VAR Word
value = 500 ' Initialize variables
anotherValue = 2000
DEBUG ? value ' Display values
DEBUG ? anotherValue
value = 10 * anotherValue ' Perform operations
DEBUG ? value ' Display values again
DEBUG ? anotherValue
END
How VariablesAndSimpleMath.bs2 Works
This code declares two word variables, value and anotherValue.
value VAR Word ' Declare variables

Table of Contents

Other manuals for Parallax Boe-Bot

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Parallax Boe-Bot and is the answer not in the manual?

Parallax Boe-Bot Specifications

General IconGeneral
BrandParallax
ModelBoe-Bot
CategoryRobotics
LanguageEnglish