otherwise method

Expr otherwise(
  1. Object value
)

Implementation

Expr otherwise(Object value) {
  // Use predicate's helper to get the same validation, temporary ownership,
  // leases, and reachability fencing as other multi-expression operations.
  return predicate._withOperands([predicate, ifTrue, value], (handles) {
    return _runtime._adoptExpr(
      _runtime._client.invokeSync('exprTernary', {
        'predicate': handles[0],
        'truthy': handles[1],
        'falsy': handles[2],
      }),
    );
  });
}