Remix.run Logo
▲ alexfortin an hour ago

I'm writing some Crystal (which has Ruby-like syntax) and I'd add `unless` to the list. I like it!

▲egeozcan an hour ago | parent | next [-]

"Unless" feels like adding come-from (next to goto) to a language. A statement/flow should not change its meaning after being declared/written IMHO.

edit: My criticism is for the suffix version to be clear. Unless / else is actually cool.

▲jibalt 23 minutes ago | parent | next [-]

`destroy_world() if $angry;` is Perl syntax. And Python has `destroy_word() if angry else live_long_and_prosper()`.

(But it's not remotely like come-from.)

P.S. in re the other response, "unless" is "if not". "until" is "while not".

▲NooneAtAll5 24 minutes ago | parent | prev [-]

wdym? "unless" is literally "while not", no come-from mechanics

▲jibalt 25 minutes ago | parent | prev [-]

`unless` came from Perl, Ruby adopted it, and so of course did Crystal.