LISP Decision Making When Construct - Lisp programming

What is When Construct in LISP?

The when macro is followed by a test clause that evaluates to t or nil. If the test clause is evaluated to nil, then no form is evaluated and nil is returned, however the test result is t, then the action following the test clause is executed.

Syntax:

Example

Create a new source code file named main.lisp and type the following code in it.

On clicking the execution button or typing Ctrl+E, LISP executes it immediately and the result is shown below:

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Lisp programming Topics