-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvar_vs_let.bas
More file actions
44 lines (34 loc) · 1.02 KB
/
var_vs_let.bas
File metadata and controls
44 lines (34 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
REM Var Vs Let - CyberBasic Example
REM This example demonstrates var vs let functionality
REM Use WASD or arrow keys to interact (where applicable)
// VAR vs LET Demo
// Both VAR and LET work identically for variable declarations
// Using LET (traditional BASIC style)
LET x = 10
LET y = 20
LET name = "CyberBasic"
// Using VAR (modern style - same as LET)
VAR a = 100
VAR b = 200
VAR greeting = "Hello"
// Both work the same way
PRINT "LET variables: x=" + STR(x) + ", y=" + STR(y) + ", name=" + name
PRINT "VAR variables: a=" + STR(a) + ", b=" + STR(b) + ", greeting=" + greeting
// You can mix them
LET mixed1 = 1
VAR mixed2 = 2
LET mixed3 = mixed1 + mixed2
PRINT "Mixed: " + STR(mixed3)
// Both work with objects
LET vec1 = Vector3(1, 2, 3)
VAR vec2 = Vector3(4, 5, 6)
LET sum = vec1.dot(vec2)
PRINT "Dot product: " + STR(sum)
// Both work with assignments
LET counter = 0
VAR maxCount = 10
WHILE counter < maxCount
counter = counter + 1
PRINT "Count: " + STR(counter)
WEND
PRINT "Both VAR and LET work identically!"