I've used kotlin extensively, where ifs and switches are expressions. I've 
also seen rust support them. Curiously, Java 12 will also support switch 
expressions, and java is about as non-expressive as it gets.

On Wednesday, December 19, 2018 at 11:39:32 PM UTC+2, Tyler Compton wrote:
>
> 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 <0xj...@gmail.com <javascript:>> 
> wrote:
>
>> On Wed, Dec 19, 2018 at 9:09 PM Viktor Kojouharov <vkojo...@gmail.com 
>> <javascript:>> 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 golang-nuts...@googlegroups.com <javascript:>.
>> 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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to