time-to-botec/squiggle/node_modules/@stdlib/utils/if-then/docs/repl.txt
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

33 lines
594 B
Plaintext

{{alias}}( bool, x, y )
If a condition is truthy, invoke `x`; otherwise, invoke `y`.
Parameters
----------
bool: boolean
Condition.
x: Function
Function to invoke if a condition is truthy.
y: Function
Function to invoke if a condition is falsy.
Returns
-------
z: any
Return value of either `x` or `y`.
Examples
--------
> function x() { return 1.0; };
> function y() { return -1.0; };
> var z = {{alias}}( true, x, y )
1.0
> z = {{alias}}( false, x, y )
-1.0
See Also
--------