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

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

RE: [External] : Handling nil values in optional argument


From: Drew Adams
Subject: RE: [External] : Handling nil values in optional argument
Date: Fri, 12 Jul 2024 02:37:12 +0000

> I have the following tool, but I want that if I pass nil in the third
> argument,
> the function does not assume that fyr was not supplied, but that fyr is
> actually
> to be used as a nil value.
> 
> (defun mundu (monbf funcs labels &optional fyr)
>   (unless fyr (setq fyr t))

You can't.  nil is the default value for an optional argument.

Instead, your code can use something other than nil for the value that you pass 
as an explicit argument.  It can use the singleton list (nil), for example.

reply via email to

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