If Construct in LISP Last Updated : 09 Nov, 2021 Comments Improve Suggest changes Like Article Like Report In this article, we will discuss the if construct in LISP. The if is a decision-making statement used to check whether the condition is right or wrong. The if the condition is right, then it will go inside the if block and execute the statements under if block. Otherwise, the statements are not executed. Syntax: (if (condition) then (statement 1).....(statement n)) Here, then is an optional keyword used inside the if statement. Example 1: LISP Program to check conditions with operators Lisp ;define value to 100 (setq val1 100) ;check the number is equal to 100 (if (= val1 100) (format t "equal to 100")) (terpri) ;check the number is greater than to 50 (if (> val1 50) (format t "greater than 50")) (terpri) ;check the number is less than to 150 (if (< val1 150) (format t "less than 150")) Output: equal to 100 greater than 50 less than 150 Example 2: Lisp ;define value to 230 (setq val1 230) ;check the number is equal to 100 (if (= val1 100) (format t "equal to 100")) (terpri) ;check the number is greater than to 50 (if (> val1 50) (format t "greater than 50")) (terpri) ;check the number is less than to 150 (if (< val1 250) (format t "less than 250")) Output: greater than 50 less than 250 Comment More infoAdvertise with us Next Article When Construct in LISP S saisravanprojects Follow Improve Article Tags : LISP LISP-Basics Similar Reads Do Construct in LISP In this article, we will discuss the Do Construct in LISP. Do construct is used to perform an iteration in a structured format. Syntax: (do ((variable1 value1 new updated value 1) (variable2 value2 new updated value 2) ------------------------------- ------------------------------- (variable n value 2 min read Loop For Construct in LISP The loop for construct in common LISP is used to iterate over an iterable, similar to the for loop in other programming languages. It can be used for the following: This is used to set up variables for iteration.It can be used for conditionally terminate the iteration.It can be used for operating on 2 min read Cond Construct in LISP In this article, we will discuss cond construct in LISP. The cond is a decision-making statement used to make n number of test conditions. It will check all the conditions. Syntax: (cond (condition1 statements) (condition2 statements) (condition3 statements) ... (conditionn statements) ) Here, The c 2 min read Case Construct in LISP In this article, we will discuss the case construct in LISP. This is used to check multiple test conditions at a time, unlike cond, if and when it allows multiple conditions. Syntax: (case (key_value) ((key1) (statement 1 .............. statement n) ) ((key2) (statement 1 .............. statement n) 2 min read When Construct in LISP In this article, we will discuss the when construct. The when is a decision-making statement used to specify the decisions. It is similar to conditional statements. Syntax: (when (condition) (statements) ) where, condition is a test statement used to teststatements are the actions that will depend o 2 min read Loop Construct in LISP In this article, we will discuss Loop Construct. This Construct is used to iterate the data until it finds the return statement. And then it will stop iterating and return the results. Syntax: (loop (statements) condition return ) where, loop is the keywordstatements are used to iterate the loopcond 2 min read Like