diff options
author | Christian Hesse <mail@eworm.de> | 2024-07-22 21:13:02 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2024-07-22 21:14:03 +0200 |
commit | 511184a4a7bbabd6b7789defb9cc65c22bb50664 (patch) | |
tree | 99b114533a4238e450e92cda9d364e32ca24fb27 /global-functions.rsc | |
parent | 8ea780554164ef14e5fddc1ab8692eec455a0d0c (diff) |
global-functions: $EitherOr: revert...
... but leave a comment.
Diffstat (limited to 'global-functions.rsc')
-rw-r--r-- | global-functions.rsc | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/global-functions.rsc b/global-functions.rsc index 4f37fa5..41120fd 100644 --- a/global-functions.rsc +++ b/global-functions.rsc @@ -382,15 +382,13 @@ :set EitherOr do={ :global IfThenElse; - :if ([ :typeof $1 ] = "bool") do={ - :return $1; - } :if ([ :typeof $1 ] = "num") do={ :return [ $IfThenElse ($1 != 0) $1 $2 ]; } :if ([ :typeof $1 ] = "time") do={ :return [ $IfThenElse ($1 > 0s) $1 $2 ]; } + # this works for boolean values, literal ones with parentheses :return [ $IfThenElse ([ :len [ :tostr $1 ] ] > 0) $1 $2 ]; } |