goby icon indicating copy to clipboard operation
goby copied to clipboard

Support Ternary Operator

Open st0012 opened this issue 6 years ago • 8 comments

For example: foo ? bar : baz

st0012 avatar May 26 '18 09:05 st0012

I thought you wouldn't adopt ternary operators in Goby 😲

hachi8833 avatar May 26 '18 12:05 hachi8833

Yep I didn’t want to support this, but this is kind of a basic component to programming language I think

st0012 avatar May 26 '18 12:05 st0012

Is this something people have complained about not having?

eliothedeman avatar May 28 '18 05:05 eliothedeman

Not yet, just I think it would be. But it might also because we don't really have much users for now.

st0012 avatar May 28 '18 05:05 st0012

Just a thought, do you want to do something like in Python style (although Goby is referenced to Ruby style syntax):

hello = 'world' if created? else 'nothing'

But this style is kind of like inline conditional which is addressed in #580

Alexius-Huang avatar Jun 05 '18 08:06 Alexius-Huang

@Maxwell-Alexius I prefer using Ruby style because python style might confuse users

st0012 avatar Jun 05 '18 08:06 st0012

Would you guys let me try to attack this in my free time? I love Ruby and Go, and have tried working with compilers/interpreters before, so I feel like it wouldn't be such an idea to attempt something like this.

spavikevik avatar Jul 19 '18 19:07 spavikevik

@spavikevik sure, feel free to work on it 😄

st0012 avatar Jul 20 '18 02:07 st0012