How to access Objective C unnamed parameters of some method?

All I’ve found on the web about parameters of methods in Objective C is that they are optional, but if I don’t label each input parameter of some method, how do I access them?

Here’s an example of what I’m trying to do:

 - (float) divNum1: (int) AndNum2: (int);

then it doesn’t even compile, saying that

an identifier was expected before ;

So on the implementation of the method above I want to access each of the input parameters:

- (float) divNum1: (int) AndNum2: (int)
{
    return <first parameter> / <second parameter>;
}

I know how to solve this using labels, what I need is the solution for this problem without naming each parameter.


Source: syntax

Leave a Reply