Oxygen Basic



Some Simple Programs

direct expression:
print "hello!"
using variable:
string s="hello!"
print s
using macro:
def greeting "hello!"
print greeting
using function:
function greeting() as string
  return "hello!"
end function

print greeting
using class:
class person
  method greeting() as string
    return "hello!"
  end method
end class

person jim
print jim.greeting
arithmetic
float v=1 2 3 4 5 7.5
print "Total: " v
print "Average: " str v/6
writing and reading files
putfile "t.txt","Hello!"
print getfile "t.txt"
variable arrays
def q 10
float v[q]<=(9,8,7,6,5,4,3)
print v[3] 'value=7
iteration
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)