32 lines
362 B
Plaintext
32 lines
362 B
Plaintext
sub map(f$, t())
|
|
local i
|
|
|
|
for i = 1 to arraysize(t(), 1)
|
|
t(i) = execute(f$, t(i))
|
|
next i
|
|
end sub
|
|
|
|
sub add1(x)
|
|
return x + 1
|
|
end sub
|
|
|
|
sub square(x)
|
|
return x * x
|
|
end sub
|
|
|
|
dim t(10)
|
|
|
|
for i = 1 to 10
|
|
t(i) = i
|
|
print t(i), "\t";
|
|
next i
|
|
print
|
|
|
|
//map("add1", t())
|
|
map("square", t())
|
|
|
|
for i = 1 to 10
|
|
print t(i), "\t";
|
|
next i
|
|
print
|