Boolean

From Valve Developer Community
(Redirected from Bool)
Jump to navigation Jump to search
English (en)Deutsch (de)Español (es)Hrvatski (hr)Русский (ru)Translate (Translate)


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 Half-Life SDK uses BOOL to represent boolean values, it is a typedef for int; 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: