USE OF LETTERS AND CHARACTERS
In 3D Basic, it is very important to use the correct letters and characters. The language is strict, and the interpreter follows exact rules.
-------------------------------------------------------------------------------------------------
1. Case Sensitivity (Uppercase and Lowercase Letters)
3D Basic is case-sensitive, which means:
-
boxRed and boxred are treated as two different objects or variables
-
You must be consistent when naming things
If you mix uppercase and lowercase incorrectly, the result may be:
-
the program does not start
-
objects are not displayed as expected
-
some lines are ignored without error messages
Example (incorrect):
10 boxRed.size=(2,2,2)
20 boxred.color=red
30 boxRed.move=(0,1,0)
40 boxRed.draw
Result:
-
The object is drawn, but it is not red
-
Line 20 is ignored because boxred ≠ boxRed
Alternative:
40 boxred.draw
Result:
-
Only line 20 is used
-
Lines 10 and 30 are ignored
-------------------------------------------------------------------------------------------------
2. Allowed Letters
Only the English alphabet is allowed:
-
A–Z
-
a–z
The following letters are not allowed:
-
å, ä, ö
-
any other non-English characters
Example (incorrect):
BoxRöd
Contains ö → not valid
-------------------------------------------------------------------------------------------------
3. Allowed Characters in Names
The following characters are allowed when naming variables and objects:
-
Letters: A–Z, a–z
-
Numbers: 0–9
-
Underscore: _
Not allowed:
-
&, #, %, etc. (in names)
Example (incorrect):
boxRed&Blue
Example (correct):
boxRed_Blue
-------------------------------------------------------------------------------------------------
4. Common Errors with Variables
Variables are also case-sensitive.
Example (incorrect):
10 varAntal=10
20 print varantal
Result:
-
Output becomes 0 or varantal (depending on interpretation)
Correct:
10 varAntal=10
20 print varAntal
Result:
-
Output is 10
-------------------------------------------------------------------------------------------------
5. Recommended Naming Style
A good general rule:
-
Use lowercase letters for variables and objects
-
Always be consistent throughout your program
Examples:
varAntal
boxRed
player1
-------------------------------------------------------------------------------------------------
6. Exceptions (Where More Characters Are Allowed)
In some contexts, you may freely use uppercase letters and special characters:
a) Text output
10 print "My name is Peter."
Here you may use:
-
uppercase letters
-
special characters
-
non-English letters
b) Text properties
10 window1.caption="Text in the window."
Same rules as print
-------------------------------------------------------------------------------------------------
7. Special Cases Where Uppercase Is Required
In some cases, uppercase letters have specific meaning and must be written exactly.
Example:
10 shape1.LetterA.size=2
Here, LetterA must use an uppercase A
Otherwise, the interpreter will ignore the line
-------------------------------------------------------------------------------------------------
8. Summary
-
3D Basic is case-sensitive
-
Only English letters are allowed in names
-
Special characters cannot be used in variable or object names
-
Be consistent with naming
-
Text strings (print, caption) allow more flexibility