|
Post by udixrunbas on Nov 14, 2011 14:39:01 GMT -5
Hello -
Liberty Basic can do it very nicely. Run Basic not?
I want to transfer a 2-dim numerical matrix into a subroutine. And therein I want to change some of its num. values. This modified matrix should then transfer back - using BYREF - into the main program.
While I can do that without problems in Liberty Basic, I seem to be unable to do this in Runbasic; the same code would not execute. And the GOSUB procedures doing this are very cumbersome.
Do I miss any tricks of the trade here ?
|
|
|
Post by StefanPendl on Nov 14, 2011 14:50:20 GMT -5
You can't do that in LB either, only with the dynamic arrays custom extension created by a LB community member.
|
|
|
Post by udixrunbas on Nov 15, 2011 8:01:00 GMT -5
Hello Stefan - how about this with LB 404:
dim a(55,55) a(4,4)=3.434 print a(4,4) call ccc a print a(4,4)
call ccc a print a(4,4) end
sub ccc byref a a(4,4)= a(4,4)+10 end sub
Or do I interpret something wrong here ? ;-) greetings udixrunbas
|
|
|
Post by StefanPendl on Nov 15, 2011 15:52:40 GMT -5
Arrays are global in LB and you do not use the numerical variable a in any case.
Run the code through the debugger and look at the variable values.
The following will return the same result.
dim a(55,55) a(4,4)=3.434 print a(4,4) call ccc print a(4,4)
call ccc print a(4,4) end
sub ccc a(4,4)= a(4,4)+10 end sub
|
|
|
Post by udixrunbas on Nov 16, 2011 3:40:20 GMT -5
Hello Stefan - thanks - I suspected I had to think twice. That usage of varibale a without brackets () of some sort looked funny and made me doubtful. greeting udixrunbas
|
|
|
Post by StefanPendl on Nov 16, 2011 17:03:13 GMT -5
The following works:
dim a(55,55) a(4,4)=3.434 print a(4,4) a(4,4)= ccc( a(4,4) ) print a(4,4)
a(4,4)= ccc( a(4,4) ) print a(4,4) end
function ccc(x) ccc= x+10 end function
|
|