Reputation: 1
We beginners get confused when a method declaration has two or more arguments and I think it is always explained using withVariable or "create" or "and" and we think it is part of the mandatory syntax and this is confusing.
eg:
-(void) createBudget:(double) aBudget withExchangeRate: (float) anExchangeRate;
The format is
-(void) someMethod:(someType) value1 secondValue: (anotherType) value2 thirdValue:
(anotherType) value3;
So if the following declaration is correct I finally understand it. Please confirm:
-(void) myMethod: (int) x aSecondValue: (float) y aThirdValue: (double) z;
and the names of these 3 methods are
Please confirm that "with" is not part of the mandatory syntax and that my third method declaration is acceptable.
Thanx.
Upvotes: 0
Views: 40
Reputation: 135
The actual method signatures would be:
createbudget:withExchangeRate:
someMethod:secondValue:thirdValue:
myMethod:aSecondValue:athirdValue:
(note the extra colon at the end of the rightmost argument)
"with", "and".. are in no way mandatory. You can use whatever wording you like, but I think it helps keep things clear.
Upvotes: 1