flofriday / Moose

🐐 A new fun programming language
MIT License
6 stars 1 forks source link

Implement Trenary C-style Operator #22

Closed flofriday closed 1 year ago

flofriday commented 1 year ago

Example

age = 43
print(age == 50 ? "Half a century baby!" : "Hey there.")

Note

I am not sure we should implement this. @Jozott00 what are your thoughts?

We used this one in the spec to describe the ?? operator but the ternary operator is not the easiest to read. However, it is useful to write quick conditions.

flofriday commented 1 year ago

I still have a problem with the parser rejecting the questionmark but I should be able figure that one out .

flofriday commented 1 year ago

Implemented