variable number of method arguments: indication practice

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
koen.h
Forum Contributor
Posts: 268
Joined: Sat May 03, 2008 8:43 am

variable number of method arguments: indication practice

Post by koen.h »

A certain method or function has a variable number of arguments. What is a good practice to code this so code hinting will be clear for everyone?

example:
setVars($fixedVar, $optionalVar1 = null, $optionalVar2 = null)

This will make it clear, I think, how I'm expecting the arguments are given.
User avatar
Chalks
Forum Contributor
Posts: 447
Joined: Thu Jul 12, 2007 7:55 am
Location: Indiana

Re: variable number of method arguments: indication practice

Post by Chalks »

I generally just put a comment above the function saying "here's what you can do with this: [explain]".
Post Reply