How to get the returned value to print any information to Log in Objective c? -


i tried not use returned value true - (bool) returntrueorfalse. compiler generates error use of undeclared identifier.

#import <foundation/foundation.h> @interface sampleclass : nsobject - (bool) returntrueorfalse; - (void) implementresult; @end  @implementation sampleclass  - (bool) returntrueorfalse{     return true; }  - (void) implementresult{     if ((bool)returntrueorfalse){         nslog(@"i called because above function returned true value");     } } @end  int main( int argc, const char *argv[]){     sampleclass *sampleclass = [[sampleclass alloc] init];     [sampleclass implementresult];  } 

you calling function/method variable

   - (void) implementresult{         if ([self returntrueorfalse]){             nslog(@"i called because above function returned true value");         }     } 

Comments