You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Conditional parameters, while only syntax sugar would be a cool way of doing different things when the input of the function is different. I am undecided on wheter this is a good idea as it is just syntax sugur and would complicate things like compilation and type checking but its a cool idea at least:
// recursively calculate the factorial of nfnfac(n:u64):u64{return n *fac(n - 1)}// when parameter n is 1 call this function insteadfnfac(n:u64 == 1):u64{return1}
The above code would be equivalent to, and while not in this case shorter it is in some ways more readable (and in some ways not):
fnfac(n:u64):u64{if n == 1{return1}return n *fac(n - 1)}
The text was updated successfully, but these errors were encountered:
Conditional parameters, while only syntax sugar would be a cool way of doing different things when the input of the function is different. I am undecided on wheter this is a good idea as it is just syntax sugur and would complicate things like compilation and type checking but its a cool idea at least:
The above code would be equivalent to, and while not in this case shorter it is in some ways more readable (and in some ways not):
The text was updated successfully, but these errors were encountered: