Older Version
Newer Version
harmonv
Nov 6, 2007
- "added explanation text for chart"
Lesson Map | Next > Numbers
In the Define Variables lesson we learned Liberty BASIC has two types of variables: numbers and strings . If the last character of the variable name is a dollar sign $ , it holds a string. If it does not have a $ on the end, it holds a number. What could be easier?
A variable name can be letters and numbers but the first character must be a letter. FirstName$, FavoriteFilmNo5$, Address2$ store strings. Total, price12, and count3 hold numbers.
In these next few lessons we will be learning much more about them ... and the power they possess.
Here is asummary table of types and names quick chart you can use to test what you've learned. Use one hand to cover all but the first column. Is each variable a number, string or illegal name. Then remove your hand to check your answers.
Lesson Map | Next > Numbers
Types of Variables
In the Define Variables lesson we learned Liberty BASIC has two types of variables: numbers and strings . If the last character of the variable name is a dollar sign $ , it holds a string. If it does not have a $ on the end, it holds a number. What could be easier?
A variable name can be letters and numbers but the first character must be a letter. FirstName$, FavoriteFilmNo5$, Address2$ store strings. Total, price12, and count3 hold numbers.
In these next few lessons we will be learning much more about them ... and the power they possess.
Here is a
| Cookbook$ | string | begins with letter, end with $ |
| Temperature | number | begins with letter, no $ on end |
| rainbow | number | begins with letter, no $ on end |
| snowflake$ | string | begins with letter, ends with $ |
| snow% | illegal | percent (%) can not be in name |
| 37acorns | illegal | begins with a number |
Lesson Map | Next > Numbers