==== ISTRUE ====
----
----
Test if an object differs from the null element of its type
----
^ __Input Stack__ ^ ^ __Output Stack__ ^
| **O** | **→** | **1/0** |
| //Level 1 / Argument 1// | //→// | //Level 1// |
{{page>manual:chapter6:aux:legend&nofooter&noeditbtn&inline}}
|**Type**| [[manual:chapter5:basics#operators|Operator]] ||
|**Parallel list processing**| [[manual:chapter5:listproc#group-2commands-that-must-use-dolist-to-parallel-process|Group 2]] ||
|**Affected by flags**| None ||
----
The ''ISTRUE'' operator tests implicitly the object on level 1 against the null element of its type and returns ''1'' if it differs or ''0'' otherwise. For each type, the null element is defined as follows:
^ Type ^ Null Element ^
| [[manual:chapter3:reals#approximate-versus-exact|Real]], [[manual:chapter3:reals#approximate-versus-exact|Integer]] or [[manual:chapter3:reals#numbers-in-other-bases|Binary number]] | ''0'' / ''#0b'' / ''#0o'' / ''#0h'' |
| [[manual:chapter3:complex|Complex number]] | ''(0,0)'' / ''(0,∡0°)'' / ''(0,∡0r)'' / ''(0,∡0g)'' / ''(0,∡0d)'' |
| [[manual:chapter3:angles|Angle]] | ''∡0°'' / ''∡0r'' / ''∡0g'' / ''∡0d'' |
| [[manual:chapter3:strings|String]] | ''""'' |
| [[manual:chapter3:lists|List]] | ''{ }'' |
| [[manual:chapter3:matrix|Vector]] or [[manual:chapter3:matrix|Matrix]] | A vector or a matrix where ''ISTRUE'' returns ''0'' for each element |
| [[manual:chapter3:units|Unit]] | A unit object with numerical part equal to ''0'' |
| [[manual:chapter4:dirs#variable-storage|Identifier]] | ''%%'%%ISTRUE(identifier)%%'%%'' FIXME |
| [[manual:chapter3:symbolic|Symbolic expression]] | ''%%'%%ISTRUE(expression)%%'%%'' FIXME |
| [[manual:chapter3:grobs|Grob]] | No null element. ''ISTRUE'' always returns ''1'' |
| [[manual:chapter3:fonts|Font]] | No null element. ''ISTRUE'' always returns ''1'' FIXME |
| [[manual:chapter3:bindata|Binary data container]] | No null element. ''ISTRUE'' always returns ''1'' |
| [[manual:chapter4:dirs#directories|Directory]] | No null element. ''ISTRUE'' always returns ''1'' |
| [[manual:chapter4:libs|Library]] | No null element. ''ISTRUE'' always returns ''1'' |
| [[manual:chapter5|Program]] | Program gets ''[[manual:chapter6:operators:cmd_ovr_xeq|XEQ]]''%%'%%ted and result is fed to ''ISTRUE'' FIXME |
----
This command is new in newRPL and does not exist in userRPL.
----
1: [ [ 0 0 ] [ 0 1 ] ]
……………………………………………………………………………………
ISTRUE
will result in
1: 1
……………………………………………………………………………………
----
1: [ [ 0 0 ] [ 0 0 ] ]
……………………………………………………………………………………
ISTRUE
will result in
1: 0
……………………………………………………………………………………
----
{{page>manual:chapter6:operators&nofooter&noeditbtn&inline}}