Boolean values: Difference between revisions

added VB & PB; changed smart quotes to normal quotes under TCL
(→‎BASIC: changed "QuickBasic" to "Most BASICs")
(added VB & PB; changed smart quotes to normal quotes under TCL)
Line 183:
Everything else is true. The keyword <tt>TRUE</tt> exists.
[http://www.php.net/manual/en/language.types.boolean.php#language.types.boolean.casting]
 
=={{header|PowerBASIC}}==
 
In addition to what's noted above under [[#BASIC|BASIC]] (above), PowerBASIC for Windows (and probably [[PB/CC]] as well) has the <code>ISTRUE</code> and <code>ISFALSE</code> functions. According to the help file, they "return the logical truth or falsity of a given expression". (PB lacks a boolean data type, so the usual practice is to use integers in [[PB/DOS]] and longs [[PB/CC]] and [[PB/Win]].)
 
<lang powerbasic>DIM x AS LONG
x = ISTRUE(1 = 1) ' returns -1
x = ISTRUE(1 = 0) ' returns 0
x = ISFALSE(1 = 1) ' returns 0
x = ISFALSE(1 = 0) ' returns -1</lang>
 
=={{header|PowerShell}}==
Line 302 ⟶ 312:
Test for the boolean value of a string can be stuff like
<lang tcl>if {[string is false -strict $string]} ...</lang>
which will test for “no”"no" or “NO”"NO" or “0”"0" or “False”"False" or ...
 
=={{header|TI-89 BASIC}}==
 
There are boolean literals <code>true</code> and <code>false</code>. No other values may be used where a boolean is expected.
 
=={{header|Visual Basic}}==
 
VB has the <code>Boolean</code> data type and the constants <code>True</code> and <code>False</code>, in addition to what's listed under [[#BASIC|BASIC]], above. When used outside of a boolean context, <code>True</code> and <code>False</code> return values depending on their context -- <code>-1</code> and <code>0</code> in a numeric context, <code>"True"</code> and <code>"False"</code> if used as strings.
 
<lang visualbasic>Dim x As Boolean
x = IIf(Int(Rnd * 2), True, False)
MsgBox x</lang>
 
=={{header|XSLT}}==
1,150

edits