Oxygen Basic
Simple Conditionals, Loops and Iteration
if...then...else:
a=5
'
if a>5 then print "a>5"
'
if a>5 then
print "a>5"
end if
'
if a>5 then
print "a>5"
else
print "a is not > 5"
end if
'
if a=0 then
print "a=0"
elseif a>5 then
print "a>5"
else
print "a is not > 5"
end if
select...case...:
a=5
'
select a
case 0 : print "a=0"
case 1 : print "a=1"
case 2 to 5 : print "a is between 2 and 5"
case else
print "a is greater than 5"
end select
for...next:
def q 10
float v[q]<=(9,8,7,6,5,4,3)
float tot
'
for i=1 to q
tot+=v[i]
next
'
print "Number: " q " Total: " v " Average: " str(v/q)
while:
def q 10
float v[q]<=(9,8,7,6,5,4,3)
float tot
i=1
while i<=q
tot+=v[i]
if ++i > q then exit while
wend
'
print "Number: " q " Total: " v " Average: " str(v/q)
do:
def q 10
def q 10
float v[q]<=(9,8,7,6,5,4,3)
float tot
i=1
do
tot+=v[i]
if ++i > q then exit do
end do
'
print "Number: " q " Total: " v " Average: " str(v/q)
|