samifox 发表于 2022-7-5 18:29:44

cond() - why ((t nill)) is com

hi
 

(cond((= s "Y") 1)   ((= s "y") 1)   ((= s "N") 0)   ((= s "n") 0)   (t nil))
 
usually functions return nill when an empty value is issue, in cond returning nill is exposed to the developer...why?

Tharwat 发表于 2022-7-5 18:34:52

With / without is the same return (nil).

samifox 发表于 2022-7-5 18:39:27

So why its a common way?(according to docs)

Tharwat 发表于 2022-7-5 18:45:21

I think it is just an example to beginners to know the use of t symbol with cond function and nothing's more.

samifox 发表于 2022-7-5 18:49:25

Is there any use of t byond the self explained true?

Tharwat 发表于 2022-7-5 18:51:26

As far as I know , no.
 
The use of t at the end of cond function is to pass any value you want if the arguments that passed to the function are not to equal to any value.

samifox 发表于 2022-7-5 18:55:49

Not sure what u mean...

Tharwat 发表于 2022-7-5 18:58:48

Do you know what is the use of symbol t at the end of cond function?

samifox 发表于 2022-7-5 19:03:44

As i understand....if t equal to t...than return nill

samifox 发表于 2022-7-5 19:09:08

Or maybe its a defult if none is true. But why?
页: [1] 2
查看完整版本: cond() - why ((t nill)) is com