fb_variables
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
fb_variables [2022/12/03 07:09] – [DIM] praetor | fb_variables [2022/12/04 01:38] – [CONST] praetor | ||
---|---|---|---|
Line 19: | Line 19: | ||
<code freebasic> | <code freebasic> | ||
- | dim personName | + | dim as string |
- | dim personAge | + | dim as integer |
- | dim radius | + | dim as single radius |
dim as integer x,y | dim as integer x,y | ||
</ | </ | ||
- | |||
- | **PITFALL** | ||
- | While it may seem that | ||
- | <code freebasic> | ||
- | dim x,y as integer | ||
- | </ | ||
- | will work, it will in fact cause a compile time error. | ||
==== VAR ==== | ==== VAR ==== | ||
Line 38: | Line 31: | ||
==== CONST ==== | ==== CONST ==== | ||
CONST variables are constants, that is their assigned value does not change. An example would be | CONST variables are constants, that is their assigned value does not change. An example would be | ||
- | < | + | < |
- | const pi as float = 3.14 | + | const as single pi = 3.14 |
</ | </ | ||
Line 59: | Line 52: | ||
First, open up your preferred text editor and enter the following statement | First, open up your preferred text editor and enter the following statement | ||
- | < | + | < |
- | dim a as integer | + | dim as integer |
- | dim b as integer | + | dim as integer |
- | dim c as integer | + | dim as integer |
a = 5 | a = 5 | ||
Line 75: | Line 68: | ||
First | First | ||
- | < | + | < |
- | dim a as integer | + | dim as integer |
- | dim b as integer | + | dim as integer |
- | dim c as integer | + | dim as integer |
</ | </ | ||
declares 3 variables of the integer type. | declares 3 variables of the integer type. | ||
- | < | + | < |
a = 5 | a = 5 | ||
b = 4 | b = 4 | ||
Line 89: | Line 82: | ||
assigns values to our 3 variables and | assigns values to our 3 variables and | ||
- | < | + | < |
print "The number is " & c | print "The number is " & c | ||
</ | </ |
fb_variables.txt · Last modified: 2022/12/04 01:39 by praetor