Returning calculated values from a subroutine (New Features)

by lrcvs, Tuesday, October 30, 2012, 22:02 (1641 days ago) @ UglyMike

A example!!!

:::::::::::::::::::::::::::::::::::::::::::::::::::::::


dim x$(1)

cls
b$ = "10 20 30 40" #data to operate

print b$
print

x$ = explode (tst1$ (b$), " ") #<<< to send >>> function tst1 (b$)


for n = 0 to 5
print x$[n] # <<< reception new data of tst1
next n
print

j = int(x$[4])
k = int(x$[5])

print j + k

end

function tst1$(b$)
dim z(1)
dim y$(7)
j$ = ""
z$ = explode (b$, " ")
for n = 0 to 3
y$[n] = z$[n]
next n

#operations
j$ = string(int(z$[0]) + int(z$[3]))
k$ = string(int(z$[2]) + int(z$[3]))

y$[4] = j$
y$[5] = k$

tst1$ = implode (y$, " ")
end function

::::::::::::::::::::::::::::::::::.


send: 10 20 30 40

reception: 10 20 30 40 50 70

50 70 new data!!!


Complete thread:

 RSS Feed of thread

powered by my little forum