Core Function Bool
From Sputnik Wiki
(Difference between revisions)
(Created page with "<pre> Bool( <expression> ) </pre> === Description === Returns the TRUE(1) or FALSE(0) representation of an expression === Parameters === ==== Expression ==== An expression t...") |
(→Remarks) |
||
Line 21: | Line 21: | ||
=== Remarks === | === Remarks === | ||
− | Sputnik | + | A bool in Sputnik can only be true or false (1 or 0 respectively). |
+ | |||
+ | When using == a bool will return true if he bool is true and the other value are 1 or higher example: | ||
+ | |||
+ | <pre> | ||
+ | ($a == true) // true as long as $a is higher than 0 | ||
+ | (true == $a) // false unless $a is 1 | ||
+ | </pre> | ||
=== Example === | === Example === |
Revision as of 01:29, 15 August 2013
Bool( <expression> )
Contents |
Description
Returns the TRUE(1) or FALSE(0) representation of an expression
Parameters
Expression
An expression to convert.
Return Value
Success: Returns 1.
Failure: Returns 0.
Remarks
A bool in Sputnik can only be true or false (1 or 0 respectively).
When using == a bool will return true if he bool is true and the other value are 1 or higher example:
($a == true) // true as long as $a is higher than 0 (true == $a) // false unless $a is 1
Example
$newValue = bool( $value );