Boolean values: Difference between revisions
Content added Content deleted
(→{{header|Vlang}}: Rename "Vlang" in "V (Vlang)") |
(implementing more simple things in my new favorite language, Rockstar, which I just started learning.) |
||
Line 2,247: | Line 2,247: | ||
see "not x : " + (not x) + nl |
see "not x : " + (not x) + nl |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
=={{header|Rockstar}}== |
|||
There are several synonyms for true and false. These include yes and no, or right and wrong. Therefore, to make a variable called Alice true and a variable called Bob false, you can write this. |
|||
<code>Alice was right. |
|||
Bob was wrong.</code> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||
The only values in Ruby that are false are: <code>false</code> and <code>nil</code>. They have synonyms <code>FALSE</code> and <code>NIL</code>. |
The only values in Ruby that are false are: <code>false</code> and <code>nil</code>. They have synonyms <code>FALSE</code> and <code>NIL</code>. |
||
Line 2,254: | Line 2,258: | ||
<code>false</code>, <code>nil</code> and <code>true</code> are singleton instances of classes <code>FalseClass</code>, <code>NilClass</code> and <code>TrueClass</code> respectively. |
<code>false</code>, <code>nil</code> and <code>true</code> are singleton instances of classes <code>FalseClass</code>, <code>NilClass</code> and <code>TrueClass</code> respectively. |
||
[http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html#UF] |
[http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html#UF] |
||
=={{header|Rust}}== |
=={{header|Rust}}== |
||
<syntaxhighlight lang="rust"> |
<syntaxhighlight lang="rust"> |