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

21 lines
362 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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