MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / VarToBOOL

Function VarToBOOL

source/script2.cpp:16802–16817  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16800
16801
16802BOOL VarToBOOL(Var &aVar)
16803{
16804 if (!aVar.HasContents()) // Must be checked first because otherwise IsNumeric() would consider "" to be non-numeric and thus TRUE. For performance, it also exploits the binary number cache.
16805 return FALSE;
16806 switch (aVar.IsNumeric())
16807 {
16808 case PURE_INTEGER:
16809 return aVar.ToInt64() != 0;
16810 case PURE_FLOAT:
16811 return aVar.ToDouble() != 0.0;
16812 default:
16813 // Even a string containing all whitespace would be considered non-numeric since it's a non-blank string
16814 // that isn't equal to 0.
16815 return TRUE;
16816 }
16817}
16818
16819
16820

Callers 2

EvaluateConditionMethod · 0.85
TokenToBOOLFunction · 0.85

Calls 4

HasContentsMethod · 0.80
IsNumericMethod · 0.80
ToInt64Method · 0.80
ToDoubleMethod · 0.80

Tested by

no test coverage detected