Apply function when true
Tests a value, x
, against a testing function, conditionally applying a function.
- Check if the value of
predicate()
isTrue
forx
and if so callwhen_true()
, otherwise returnx
.
Tests a value, x
, against a testing function, conditionally applying a function.
predicate()
is True
for x
and if so call when_true()
, otherwise return x
.