RosettaCodeData/Task/Apply-a-callback-to-an-array/FutureBasic/apply-a-callback-to-an-arra...

21 lines
362 B
Plaintext

include "NSLog.incl"
void local fn Callback( n as NSInteger )
NSLog( @"Square root of %ld = %f", n, sqr(n) )
end fn
void local fn DoIt
NSUInteger i, count
CFArrayRef array = @[@1, @2, @3, @4, @5, @6, @7, @8, @9, @10]
count = len(array)
for i = 0 to count -1
fn Callback( fn NumberIntegerValue( array[i] ) )
next
end fn
fn DoIt
HandleEvents