There is some precedent. Python has an if expression of sorts that is distinct from its if statements:
print(value1 if condition else value2) And in all Lisp dialects I'm familiar with, if is an expression: (print (if condition value1 value2)) Not to say that this means Go should support it necessarily. On Wed, Dec 19, 2018 at 12:16 PM Jan Mercl <[email protected]> wrote: > On Wed, Dec 19, 2018 at 9:09 PM Viktor Kojouharov <[email protected]> > wrote: > > > > I'm interested to know whether it was considered (I can't imagine that > it wasn't) for if and switch statements to be expressions instead > > I can't imagine it was considered. Is there a precedence in other > language? Not even C supports that. > > > -- > > -j > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
