conditional method

Expression conditional(
  1. Expression whenTrue,
  2. Expression whenFalse
)

Return {this} ? {whenTrue} : {whenFalse}.

Implementation

Expression conditional(Expression whenTrue, Expression whenFalse) =>
    Expression([
      this,
      Space(),
      Code('?'),
      Space(),
      whenTrue,
      Space(),
      Code(':'),
      Space(),
      whenFalse
    ]);