From 8ea780554164ef14e5fddc1ab8692eec455a0d0c Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 22 Jul 2024 17:57:22 +0200 Subject: global-functions: $EitherOr: pass boolean value Note that literal "true" or "false" (even without quotes) is converted to string. So you may have to enclose it in parentheses for a boolean value: > :put [ :typeof [ $EitherOr true false ] ]; str > :put [ :typeof [ $EitherOr (true) (false) ] ]; bool --- global-functions.rsc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/global-functions.rsc b/global-functions.rsc index 54dcb68..4f37fa5 100644 --- a/global-functions.rsc +++ b/global-functions.rsc @@ -382,6 +382,9 @@ :set EitherOr do={ :global IfThenElse; + :if ([ :typeof $1 ] = "bool") do={ + :return $1; + } :if ([ :typeof $1 ] = "num") do={ :return [ $IfThenElse ($1 != 0) $1 $2 ]; } -- cgit v1.2.3-70-g09d2