Boolean: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
Le Glaconus (talk | contribs) (added info about memory size) |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{LanguageBar}} | ||
A '''boolean''' value is a toggle used in programming that is inherently exclusively either "on" or "off". When ''enabled'' it is denoted with <code>true</code> or <code>1</code>, and with <code>false</code> or <code>0</code> when ''disabled'', depending on the syntax of the language being used. | A '''boolean''' value is a toggle used in programming that is inherently exclusively either "on" or "off". When ''enabled'' it is denoted with <code>true</code> or <code>1</code>, and with <code>false</code> or <code>0</code> when ''disabled'', depending on the syntax of the language being used. | ||
Its use varies in different areas of the engine: | Its use varies in different areas of the engine: | ||
* C++ code ''generally'' uses <code>true / false</code> | * C++ code ''generally'' uses <code>true / false</code>, which occupies 1 [[byte]]. | ||
* [[ | * The unmodified {{hl|2}} SDK uses <code>BOOL</code> to represent boolean values, it is a typedef for <code>int</code>; therefore it uses 4 bytes instead of 1. | ||
* [[ | * [[Material]]s use <code>1 / 0</code> | ||
* [[Weapon script|Weapon Scripts]] use <code>1 / 0</code> | |||
* [[VMF|.VMF]] files use <code>1 / 0</code> | * [[VMF|.VMF]] files use <code>1 / 0</code> | ||
* [[DMX|.DMX]] files {{todo|Verify how, and which form}} | * [[DMX|.DMX]] files {{todo|Verify how, and which form}} | ||
* [[VCD|.VCD]] files use <code>1 / 0</code> | |||
Certain file types used in Source also do not ''typically'' use booleans: | Certain file types used in Source also do not ''typically'' use booleans: | ||
* [[QC|.QC]] files | * [[QC|.QC]] files | ||
* [[ | * [[Studiomdl Data|.SMD]] files | ||
[[Category:Glossary]] | [[Category:Glossary]] |
Latest revision as of 14:49, 28 May 2025
A boolean value is a toggle used in programming that is inherently exclusively either "on" or "off". When enabled it is denoted with true
or 1
, and with false
or 0
when disabled, depending on the syntax of the language being used.
Its use varies in different areas of the engine:
- C++ code generally uses
true / false
, which occupies 1 byte. - The unmodified
Half-Life SDK uses
BOOL
to represent boolean values, it is a typedef forint
; therefore it uses 4 bytes instead of 1. - Materials use
1 / 0
- Weapon Scripts use
1 / 0
- .VMF files use
1 / 0
- .DMX files Todo: Verify how, and which form
- .VCD files use
1 / 0
Certain file types used in Source also do not typically use booleans: