Comparison Operators in LISP Last Updated : 07 Sep, 2021 Comments Improve Suggest changes Like Article Like Report In this article, we will discuss the comparison operators in LISP. These operators are used to compare numbers by taking two or more operands. Note: This will work only on numbers, Different comparison operators are:OperatorSyntaxNameDescription== operand1 operand2equal toThis operator checks if the values of the operands are all equal or not, if yes, will return T(True) otherwise NIL/=/= operand1 operand2not equal toThis operator checks if the values of the operands are not equal, if yes, will return NIL otherwise T (True)>> operand1 operand2greater thanThis operator checks if the values of the operand 1 are greater than operand 2, if yes then it returns True, otherwise NIL<<operand1 operand2less thanThis operator checks if the values of the operand 1 are less than operand 2, if yes then it returns True, otherwise NIL>=>= operand1 operand2greater than or equal toThis operator checks if the values of the operand 1 are greater than or equal to operand 2, if yes then it returns True, otherwise NIL<=<= operand1 operand2less than or equal toThis operator checks if the values of the operand 1 are less than or equal to operand 2, if yes then it returns True, otherwise NILmaxmax operand1 operand2maximum numberThis operator returns the maximum value.minmin operand1 operand2minimum numberThis operator returns the minimum value. Example: LISP Program demo on comparison operators. Lisp ;set value 1 to 100 ; set value 2 to 200 (setq val1 100) (setq val2 200) ;check val1 is equal to val2 or not (print (= val1 val2)) ;check val1 is not equal to val2 or not (print (/= val1 val2)) ;check val1 is greater than val2 or not (print (> val1 val2)) ;check val1 is less than val2 or not (print (< val1 val2)) ;check val1 is greater than or equal to val2 or not (print (>= val1 val2)) ;check val1 is less than or equal to val2 or not (print (<= val1 val2)) ;get maximum number among val1 and val2 (print (max val1 val2)) ;get minimum number among val1 and val2 (print (min val1 val2)) Output: NIL T NIL T NIL T 200 100 Example 2: Lisp ;set value 1 to 20 ; set value 2 to 70 (setq val1 20) (setq val2 70) ;check val1 is equal to val2 or not (print (= val1 val2)) ;check val1 is not equal to val2 or not (print (/= val1 val2)) ;check val1 is greater than val2 or not (print (> val1 val2)) ;check val1 is less than val2 or not (print (< val1 val2)) ;check val1 is greater than or equal to val2 or not (print (>= val1 val2)) ;check val1 is less than or equal to val2 or not (print (<= val1 val2)) ;get maximum number among val1 and val2 (print (max val1 val2)) ;get minimum number among val1 and val2 (print (min val1 val2)) Output: NIL T NIL T NIL T 70 20 Example 3: LISP program operands with equal numbers. Lisp ;set value 1 to 50 ; set value 2 to 50 (setq val1 50) (setq val2 50) ;check val1 is equal to val2 or not (print (= val1 val2)) ;check val1 is not equal to val2 or not (print (/= val1 val2)) ;check val1 is greater than val2 or not (print (> val1 val2)) ;check val1 is less than val2 or not (print (< val1 val2)) ;check val1 is greater than or equal to val2 or not (print (>= val1 val2)) ;check val1 is less than or equal to val2 or not (print (<= val1 val2)) ;get maximum number among val1 and val2 (print (max val1 val2)) ;get minimum number among val1 and val2 (print (min val1 val2)) Output: T NIL NIL NIL T T 50 50 Comment More infoAdvertise with us Next Article What are Comparison Operators in R? M manojkumarreddymallidi Follow Improve Article Tags : LISP LISP-Basics Similar Reads C++ Comparison Operators Comparison operators are operators used for comparing two elements, these are mostly used with if-else conditions as they return true-false as result. There are mainly 6 Comparison Operators namely: Greater than (>) : this operator checks whether operand1 is greater than operand2. If the result t 3 min read Comparison Operators in Solidity Comparison Operators are used to compare two values. Solidity has the following types of comparison operators: Greater than: Greater than operator compares two operands. It evaluates to true when the left operand is greater than the right operand otherwise false. It is denoted by >.Lesser than: L 3 min read Operators in LISP Operators are the foundation of any programming language. Thus the functionality of the LISP programming language is incomplete without the use of operators. We can define operators as symbols that help us to perform specific mathematical and logical computations on operands. In other words, we can 5 min read Bitwise Operators in LISP In this article, we will discuss the Bitwise operators in LISP. These operators are used to perform the manipulation of individual bits of a number. The truth table for bitwise AND, NAND, OR, XOR, NOR, & XNOR: aba and b a nand ba or b a xor b a nor b a xnor b00010011010111001110100110011100 Dif 4 min read What are Comparison Operators in R? Comparison operators are fundamental tools in any programming language, allowing you to compare values and make decisions based on the results. In R Programming Language comparison operators are used to compare numeric, string, and other types of data. They return a logical value (TRUE or FALSE) bas 3 min read LISP - Comparison Operators on Characters & Strings The contents of a field are compared to the contents of another field or a constant using Comparison operators. In Simple words, comparator operators are used to compare whether the two or more different values are equal or not. Comparison Operators on Character: Characters are not supported by num 3 min read Like