Variables: Difference between revisions

721 bytes removed ,  2 years ago
Line 3,766:
# example1 now refers to a string object.
example1 = "goodbye"
</lang>
 
=={{header|OxygenBasic}}==
<lang>
'WAYS OF DECLARING VARIABLES
'AND ASSIGNING VALUES
var int a,b,c,d
int a=1,b=2,c=3,d=4
dim int a=1,b=2, c=3, d=4
dim as int a=1,b=2, c=3, d=4
dim a=1,b=2, c=3, d=4 as int
print c '3
 
'CREATING ARRAY VARIABLES
int array[100]
dim int a={10,20,30,40} 'implicit array
print a[3] '30
 
'COMMONLY USED TYPES:
'byte word int sys float char string
 
'LIMITING SCOPE
dim int a=10
scope
dim int a=100
dim int b=1000
print a '100
end scope
print a 'prior a: 10
print b 'error b is out of scope
 
'REFERENCING VARIABLES
dim int*p 'p is a pointer variable
dim int a={2,4,6,8}
@p=@a[3] 'address of p is assigned address of a[3]
print @p 'the address
print p '6
print p[1] '6
print p[2] '8
</lang>
 
54

edits