Variable Names
A QBasic variable name can contain up to 40 characters (letters, numbers, and periods). In addition, you can append one of the following characters to the name to indicate a specific variable type:
% = Integer variable
& = Long integer variable
! = Single-precision variable
# = Double-precision variable
$ = String variable
Names reserved for Basic commands, functions, or operator names cannot be used as variable names. QBasic is not case sensitive. (For example, the variable names count and COUNT are identical to QBasic.)
CHR$()
This returns the string value of an ASCII character.
CHR$([Character number])
This is used a lot for inputting keyboard keys. Some keyboard keys cannot be type (e.g. the Esc key or the F Buttons). So the programmer has to make up for this with the CHR$ command. Here is a list of some character numbers:
odd % even
Are you starting a programming class?
This seems too simple:
step 1) let n = 1
step 2) if n is even display n "is even"
if n is odd display n "is odd"
step 3) increase n by 1
step 4) if n <= 50 then goto step 2
This seems too simple:
step 1) let n = 1
step 2) if n is even display n "is even"
if n is odd display n "is odd"
step 3) increase n by 1
step 4) if n <= 50 then goto step 2
No comments:
Post a Comment