Eggheads: optional parameters in proc definition

Chris Northwood chris at animebots.co.uk
Sat Jul 17 05:21:51 CST 2004


http://www.tcl.tk/man/tcl8.3/TclCmd/proc.htm

There is one special case to permit procedures with variable numbers of
arguments. If the last formal argument has the name args, then a call to the
procedure may contain more actual arguments than the procedure has formals.
In this case, all of the actual arguments starting at the one that would be
assigned to args are combined into a list (as if the list command had been
used); this combined value is assigned to the local variable args.

This may also be of use to you. 

|-----Original Message-----
|From: eggheads-bounces at eggheads.org 
|[mailto:eggheads-bounces at eggheads.org] On Behalf Of Graeme Donaldson
|Sent: 17 July 2004 08:17
|To: Eggdrop Discussion List
|Subject: Re: Eggheads: optional parameters in proc definition
|
|On Sat, July 17, 2004 4:21 am, CoolCold said:
|> Xm...couldn't find this in proc description for tcl 8.3.4 at least.
|> can u give me link to man/info?
|
|>From http://www.tcl.tk/man/tcl8.3/TclCmd/proc.htm:
|
|"Args specifies the formal arguments to the procedure. It 
|consists of a list, possibly empty, each of whose elements 
|specifies one argument. Each argument specifier is also a list 
|with either one or two fields. If there is only a single field 
|in the specifier then it is the name of the argument; if there 
|are two fields, then the first is the argument name and the 
|second is its default value."
|
|--
|Graeme Donaldson
|Souperman @ #eggdrop @ Undernet
|http://www.eggdrop.za.net/
|





More information about the Eggheads mailing list