From 511184a4a7bbabd6b7789defb9cc65c22bb50664 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 22 Jul 2024 21:13:02 +0200 Subject: global-functions: $EitherOr: revert... ... but leave a comment. --- global-functions.rsc | 4 +--- 1 file changed, 1 insertion(+), 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 ]; } -- cgit v1.2.3-70-g09d2