summaryrefslogtreecommitdiff
path: root/doc/classes/bool.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/bool.xml')
-rw-r--r--doc/classes/bool.xml66
1 files changed, 47 insertions, 19 deletions
diff --git a/doc/classes/bool.xml b/doc/classes/bool.xml
index ce4d000a9b..f3b16217e5 100644
--- a/doc/classes/bool.xml
+++ b/doc/classes/bool.xml
@@ -4,7 +4,7 @@
Boolean built-in type.
</brief_description>
<description>
- Boolean is a built-in type. There are two boolean values: [code]true[/code] and [code]false[/code]. You can think of it as an switch with on or off (1 or 0) setting. Booleans are used in programming for logic in condition statements, like [code]if[/code] statements.
+ Boolean is a built-in type. There are two boolean values: [code]true[/code] and [code]false[/code]. You can think of it as a switch with on or off (1 or 0) setting. Booleans are used in programming for logic in condition statements, like [code]if[/code] statements.
Booleans can be directly used in [code]if[/code] statements. The code below demonstrates this on the [code]if can_shoot:[/code] line. You don't need to use [code]== true[/code], you only need [code]if can_shoot:[/code]. Similarly, use [code]if not can_shoot:[/code] rather than [code]== false[/code].
[codeblocks]
[gdscript]
@@ -49,6 +49,7 @@
[/csharp]
[/codeblocks]
The following code will set [code]can_shoot[/code] to [code]false[/code] and start a timer. This will prevent player from shooting until the timer runs out. Next [code]can_shoot[/code] will be set to [code]true[/code] again allowing player to shoot once again.
+ [codeblocks]
[gdscript]
var _can_shoot = true
onready var _cool_down = $CoolDownTimer
@@ -91,32 +92,59 @@
<tutorials>
</tutorials>
<methods>
- <method name="bool">
- <return type="bool">
- </return>
- <argument index="0" name="from" type="int">
- </argument>
+ <method name="bool" qualifiers="constructor">
+ <return type="bool" />
<description>
- Cast an [int] value to a boolean value, this method will return [code]false[/code] if [code]0[/code] is passed in, and [code]true[/code] for all other ints.
+ Constructs a default-initialized [bool] set to [code]false[/code].
+ </description>
+ </method>
+ <method name="bool" qualifiers="constructor">
+ <return type="bool" />
+ <argument index="0" name="from" type="bool" />
+ <description>
+ Constructs a [bool] as a copy of the given [bool].
</description>
</method>
- <method name="bool">
- <return type="bool">
- </return>
- <argument index="0" name="from" type="float">
- </argument>
+ <method name="bool" qualifiers="constructor">
+ <return type="bool" />
+ <argument index="0" name="from" type="float" />
<description>
Cast a [float] value to a boolean value, this method will return [code]false[/code] if [code]0.0[/code] is passed in, and [code]true[/code] for all other floats.
</description>
</method>
- <method name="bool">
- <return type="bool">
- </return>
- <argument index="0" name="from" type="String">
- </argument>
+ <method name="bool" qualifiers="constructor">
+ <return type="bool" />
+ <argument index="0" name="from" type="int" />
+ <description>
+ Cast an [int] value to a boolean value, this method will return [code]false[/code] if [code]0[/code] is passed in, and [code]true[/code] for all other ints.
+ </description>
+ </method>
+ <method name="operator !=" qualifiers="operator">
+ <return type="bool" />
+ <argument index="0" name="right" type="bool" />
+ <description>
+ Returns [code]true[/code] if two bools are different, i.e. one is [code]true[/code] and the other is [code]false[/code].
+ </description>
+ </method>
+ <method name="operator &lt;" qualifiers="operator">
+ <return type="bool" />
+ <argument index="0" name="right" type="bool" />
+ <description>
+ Returns [code]true[/code] if left operand is [code]false[/code] and right operand is [code]true[/code].
+ </description>
+ </method>
+ <method name="operator ==" qualifiers="operator">
+ <return type="bool" />
+ <argument index="0" name="right" type="bool" />
+ <description>
+ Returns [code]true[/code] if two bools are equal, i.e. both are [code]true[/code] or both are [code]false[/code].
+ </description>
+ </method>
+ <method name="operator &gt;" qualifiers="operator">
+ <return type="bool" />
+ <argument index="0" name="right" type="bool" />
<description>
- Cast a [String] value to a boolean value, this method will return [code]false[/code] if [code]""[/code] is passed in, and [code]true[/code] for all non-empty strings.
- Examples: [code]bool("False")[/code] returns [code]true[/code], [code]bool("")[/code] returns [code]false[/code].
+ Returns [code]true[/code] if left operand is [code]true[/code] and right operand is [code]false[/code].
</description>
</method>
</methods>