Task

Show how to return more than one value from a function.




 
 
'============
class vector4
'============
 
float w,x,y,z
 
method values(float fw,fx,fy,fz)
this <= fw, fx, fy, fz
end method
 
method values(vector4 *v)
this <= v.w, v.x, v.y, v.z
end method
 
method values() as vector4
return this
end method
 
method ScaledValues(float fw,fx,fy,fz) as vector4
static vector4 v
v <= w*fw, x*fx, y*fy, z*fz
return v
end method
 
method ShowValues() as string
string cm=","
return w cm x cm y cm z
end method
 
end class
 
vector4 aa,bb
 
bb.values = 1,2,3,4
 
aa.values = bb.Values()
 
print aa.ShowValues() 'result 1,2,3,4
 
aa.values = bb.ScaledValues(100,100,-100,100)
 
print aa.ShowValues() 'result 100,200,-300,400 
 
 