Does iPhone SDK Objective C support functions inside of functions?

Posted by Moshe on Stack Overflow See other posts from Stack Overflow or by Moshe
Published on 2010-03-17T13:42:43Z Indexed on 2010/03/17 13:51 UTC
Read the original article Hit count: 227

I know that javascript, for example supports functions inside of functions, like so:

function doSomething(){

  function doAnothingThing(){
    //this function is redefined every time doSomething() is called and only exists inside doSomething()    
  }

  //you can also stick it inside of conditions

  if(yes){
    function doSomethingElse(){
      //this function only exists if yes is true
    }
  }


}

Does objective-c support this? Theoretical example:

 -(void) doSomething:(id) sender{
   -(void) respondToEvent: (id) sender{
     //theoretically? ... please?
   }
}

BONUS: What is the proper term for a "local" function?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone-sdk