help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to write specify default values for function arguments?


From: Tony
Subject: Re: How to write specify default values for function arguments?
Date: Tue, 1 Oct 2002 16:06:36 -0400

"gnuist006" <gnuist006@hotmail.com> wrote in message
b00bb831.0210011045.5f29a1b4@posting.google.com">news:b00bb831.0210011045.5f29a1b4@posting.google.com...
> I am looking for multiple ways for
> specifying default values for function arguments
> as you can do in C++.
>
> thanks

use &optional, any parameters left out will be nil.

(defun foo (required-arg &optional opt1 opt2)
 (unless opt1 (setq opt1 default-val-1))
 (unless opt2 (setq opt2 default-val-2))
 ...)

-Tony





reply via email to

[Prev in Thread] Current Thread [Next in Thread]