Cond Construct in LISP Last Updated : 09 Nov, 2021 Comments Improve Suggest changes Like Article Like Report 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 conditions specify different conditions - if condition1 is not satisfied, then it goes for next condition IE condition until the last condition.The statements specify the work done based on the condition. Note: It will execute only one statement. Example 1: LISP program to check whether a number is greater than 200 or not Lisp ;set value1 to 500 (setq val1 500) ;check whether the val1 is greater than 200 (cond ((> val1 200) (format t "Greater than 200")) (t (format t "Less than 200"))) Output: Greater than 200 Example 2: Demo with comparison operators Lisp ;set value1 to 500 (setq val1 500) ;check whether the val1 is greater than 200 (cond ((> val1 200) (format t "Greater than 200")) (t (format t "Not"))) (terpri) ;check whether the val1 is equal to 500 (cond ((= val1 500) (format t "equal to 500")) (t (format t "Not"))) (terpri) ;check whether the val1 is equal to 600 (cond ((= val1 600) (format t "equal to 500")) (t (format t "Not"))) (terpri) ;check whether the val1 is greater than or equal to 400 (cond ((>= val1 400) (format t "greater than or equal to 400")) (t (format t "Not"))) (terpri) ;check whether the val1 is less than or equal to 600 (cond ((<= val1 600) (format t "less than or equal to 600")) (t (format t "Not"))) Output: Greater than 200 equal to 500 Not greater than or equal to 400 less than or equal to 600 Comment More infoAdvertise with us Next Article Do Construct in LISP S saisravanprojects Follow Improve Article Tags : LISP LISP-Basics Similar Reads 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 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 If Construct in LISP 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 exec 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 Defstruct in LISP A structure is a user-defined data type that helps us combine different data items of different types under the same name. Â In Lisp, defstruct is used to define a structure of multiple data items of different data types. Syntax: (defstruct studentnameclassroll-nobirth-date)Â In the above declaration 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 Like