Does the function have bonus point or is it something just for fun?

The conditional expression (also known as ternary operator)
is for cond ? consequence : alternative.
It is an ungraded bonus.
Therefore, it is just for fun and the challenge to implement it correctly.

1 Like

It can be implemented as an if expression or a new class can be created. Then I assume the implementation for the function and the string representation is left to the student.

There is no If expression (or rather you would call the ConditinoalExpression an IfExpression). Only an If statement.
The conditional expression is not hard to implement but also not straightforward (for instance, some special cases on pointers need to be followed).
The string representation will not be tested in the AST tests as it is an ungraded bonus.

1 Like