Boolean values: Difference between revisions
Content added Content deleted
m (→{{header|AWK}}) |
(→{{header|CMake}}: 4th CMake example) |
||
Line 133: | Line 133: | ||
=={{header|Clojure}}== |
=={{header|Clojure}}== |
||
The boolean constants are ''true'' and ''false''. In a conditional context, the only false values are ''false'' and ''nil'' -- every other value is true. |
The boolean constants are ''true'' and ''false''. In a conditional context, the only false values are ''false'' and ''nil'' -- every other value is true. |
||
=={{header|CMake}}== |
|||
<lang cmake>foreach(var 1 42 ON yes True y Princess |
|||
0 OFF no False n Princess-NOTFOUND) |
|||
if(var) |
|||
message(STATUS "${var} is true.") |
|||
else() |
|||
message(STATUS "${var} is false.") |
|||
endif() |
|||
endforeach(var)</lang> |
|||
<pre>-- 1 is true. |
|||
-- 42 is true. |
|||
-- ON is true. |
|||
-- yes is true. |
|||
-- True is true. |
|||
-- y is true. |
|||
-- Princess is true. |
|||
-- 0 is false. |
|||
-- OFF is false. |
|||
-- no is false. |
|||
-- False is false. |
|||
-- n is false. |
|||
-- Princess-NOTFOUND is false.</pre> |
|||
The strings "0", "OFF", "NO", "FALSE" and "N" (ignoring case) are false. Any string ending with "-NOTFOUND" (ignoring case) is false. All other strings are true. |
|||
Scripts that want <code>if(TRUE)</code> should require CMake 2.8; do refer to [http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0012 cmake --help-policy CMP0012]. |
|||
=={{header|Common Lisp}}== |
=={{header|Common Lisp}}== |