Does iPhone SDK Objective C support functions inside of functions?

iphone, message, methods, objective-c

Solution

The usual term is nested function. gcc supports nested functions as an extension to C (disabled by default). I don't think this option is available with Objective-C (or C++) with gcc though, and even if it were it's probably not a good idea to use it (portability etc).

gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html

Problem

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?

Original source