mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-15 12:34:27 +02:00
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
This commit is contained in:
parent
380b3b3137
commit
8ea7805541
1 changed files with 3 additions and 0 deletions
|
@ -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 ];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue