-
Notifications
You must be signed in to change notification settings - Fork 3
Add ternary operator #97
Copy link
Copy link
Open
Labels
featureNew feature or requestNew feature or request
Description
This seems particularly useful to construct types.
func range_up (u64_t from, u64_t to) -> array_t(u64_t, from < to ? to - from : 0);
func range_down(u64_t from, u64_t to) -> array_t(u64_t, from > to ? from - to : 0);Also, the returned value might be a dependent type
func zero(bool_t which) -> which ? i32_t : bool_t
{
return which ? 0 : false;
}But this is not really surprising because all functional languages have the expression if x then y else z .
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew feature or requestNew feature or request