Re: Correction of 'Yet another...'
Re: Correction of 'Yet another...'
- Subject: Re: Correction of 'Yet another...'
- From: Donald Brown <email@hidden>
- Date: Thu, 06 Dec 2001 10:28:49 -0600
It's for readability. With Add values, yes, the order doesn't matter. But
how about
-(float)LevelPayments:(float)totalAmount over:(int)periods
at:(float)interestRate
{
}
Or, for a form of polymorphism:
-(void)printRecord:(MyRecord*)record
{
}
-(void)printRecord:(MyRecord*)record usingParams:(NSArray*)paramsList
{
}
Donald
on 12/6/01 9:59 AM, Martin Kautz at email@hidden wrote:
>
Hello list,
>
>
this time it's about functions (at least what I would consider as
>
functions).
>
>
In PHP (http://www.php.net, that's from where I come) a function with
>
arguments is written as
>
>
function addvalues ($arg1, $arg2) {
>
return $arg1+$arg2;
>
}
>
>
This would be called as:
>
$sum=addvalues(2,3); (should be five)
>
>
What I don't understand is the syntax in Obj-C... As long as I only use one
>
argument it's fine. However, If I'm using more than one arguments, it looks
>
kinda strange to me, since I can't differ the two arguments that good.
>
>
- (int) addvalues:(int)arg1 second:(int) arg2 {
>
return (arg1+arg2);
>
}
>
>
sum=[self simpleMath:2 second:3];
>
>
>
Can someone explain that 'second' thing?
>
Why not that way:
>
- (int) addvalues:(int)arg1, (int) arg2 {
>
return (arg1+arg2);
>
}
>
>
sum=[self simpleMath:2,3];
>
>
Thank you!
>
Martin
>
>
P.S. Forgive me, if this is too stupid for this list.
>
_______________________________________________
>
cocoa-dev mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
--
Donald Brown
email@hidden
http://www.eamontales.com
We have met the enemy and he is us - Pogo