Re: Getting the Max number from a set of numbers
Quote from Forum Archives on April 5, 2022, 7:59 pmPosted by: kashmidheiser <kashmidheiser@...>
Back to Rich's original post in this thread he asked:
The following works in Objective-C
But how is this done in FutureBasic? (without using a C Function)
NSArray *unsortedArray = @[ @2, @44, @11, @99, @35 ];
NSNumber *maxNumber = [unsortedArray valueForKeyPath:@"@max.self"];
NSLog(@"%@", maxNumber); // 99
Here's the answer, I just wish I could claim this as my own. 😀We took the long way around to get here, but it was fun!Keninclude "NSLog.incl"local fn DoItCFArrayRef unsortedArray = @[@2,@44,@99,@35]CFNumberRef maxNumber = fn ObjectValueForKeyPath( (ObjectRef)unsortedArray, @"@max.self" )NSLog(@"%@",maxNumber)end fnfn DoItHandleEvents
--
To unsubscribe, send ANY message to: [email protected] To access the list archives, go to: http://freegroups.net/groups/futurebasic/
Posted by: kashmidheiser <kashmidheiser@...>
The following works in Objective-C
But how is this done in FutureBasic? (without using a C Function)
NSArray *unsortedArray = @[ @2, @44, @11, @99, @35 ];
NSNumber *maxNumber = [unsortedArray valueForKeyPath:@"@max.self"];
NSLog(@"%@", maxNumber); // 99
--
To unsubscribe, send ANY message to: [email protected] To access the list archives, go to: http://freegroups.net/groups/futurebasic/