' class test addition, division
'
class statis
method plus() as double
method average() as double
dax(100) as double
dnx as long
end class
'----------------
methods of statis
'================
method plus() as double
dim i as integer
for i = 1 to this.dnx
method += this.dax(i)
next
end method
method average() as double
method = this.plus / this.dnx 'division
'method = this.plus + this.dnx 'addition
end method
end methods
'test
dim stx as statis
stx.dax => 2,4,6,8,10,12,14,16,18,20
stx.dnx = 8
print `plus: ` str(stx.plus) ` Average: ` str stx.average ' 72, 9 '' 72,80
[Code[
' francolinox/halProment-Basic
'-- new features: pys, p?, msgbox
'-- calc example 4
'
pim a,b,c,d,e as pro
pim z as pys
z=3
a=20
b=30
c=40
d=a*b
e=d*b
string s,st
pstring strx
strx = "powerbasic is a good basic program"
p? strx
s="Hello Batman " + str(d)
st="Hello Superman " + str(e)
print s
printy st
p? z
msgbox "hello"
' simple calc with printy and p?
' and two different functions with a friendly pbmain()
'
pim a,b,c,d,e as pro
pim s,st as pstring
a=30
b=40
c=50
d=a*b
e=d*c
s= "Hello Superman "+str(d)
st= "Hello Ironman "+str(e)
printy s
p? st
function pbmain() as long
pro a=2345
pstring s="I am thor "+a
'print s
return a
end function
print pbmain() '2345
function pbmain() as long
pro a=2345
pstring s="I am thor "+a
print s
'return a
end function
pbmain() ' I am Thor 2345
Page created in 0.176 seconds with 10 queries.