To boolean: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Grotfang
mNo edit summary
imported>Grotfang
mNo edit summary
Line 19: Line 19:
* strings return false for anything except "true".
* strings return false for anything except "true".
* integers return true for anything except 0.
* integers return true for anything except 0.
* floats return true for anything except -1.0 to 1.0.
* floats return true for anything except -1.0 to 1.0 (not inclusive).
* locations return false.
* locations return false.
* items return true.
* items return true.
Line 33: Line 33:
needscode=yes|
needscode=yes|


see_also={{SeeAlso|}}|
cli_equiv=The CLI command |
more_info= |
special= |
}}
}}

Revision as of 00:53, 11 March 2010

needs(code_samples);

Function Syntax

boolean to_boolean( any anything)

  • anything is any data type that KoLmafia uses

Datatype behaviour:

  • strings return false for anything except "true".
  • integers return true for anything except 0.
  • floats return true for anything except -1.0 to 1.0 (not inclusive).
  • locations return false.
  • items return true.
  • monsters return false.
  • skills return true.
  • effects return true.
  • elements return false for [none] but true for everything else.
  • slots return false for [hat] but true for everything else.
  • stats return true.
  • familiars return true.
  • classes return false for [seal clubber] but true for everything else.