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...") |
m (1 revision) |
||
(3 intermediate revisions by one user not shown) | |||
Line 15: | Line 15: | ||
=== Return Value === | === Return Value === | ||
− | Success: Returns | + | Success: Returns true. |
− | Failure: Returns | + | Failure: Returns false. |
=== 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 === |
Latest revision as of 12:37, 14 June 2015
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 true.
Failure: Returns false.
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 );