If a condition is truthy, return
x; otherwise, returny.
var ifelse = require( '@stdlib/utils/if-else' );If a condition is truthy, returns x; otherwise, returns y.
var z = ifelse( true, 1.0, -1.0 );
// returns 1.0
z = ifelse( false, 1.0, -1.0 );
// returns -1.0var randu = require( '@stdlib/random/base/randu' );
var ifelse = require( '@stdlib/utils/if-else' );
var z;
var i;
for ( i = 0; i < 100; i++ ) {
z = ifelse( randu() > 0.9, 'BOOP', 'beep' );
console.log( z );
}@stdlib/utils/async/if-else: if a predicate function returns a truthy value, returnx; otherwise, returny.@stdlib/utils/if-then: if a condition is truthy, invokex; otherwise, invokey.