3 ms·
This breaks once the first editor with proportional width font support becomes popular in Ruby land: kind = case year when 1850..1889 then "Blues"
by gurkendoktor 15y ago
This breaks once the first editor with proportional width font support becomes popular in Ruby land:
kind = case year
when 1850..1889 then "Blues"
...
I also have a question that I have always wanted to ask. I am not a native speaker of English. Are "if not" and "unless" really the same thing?
Does this:
def foo(x, y, z)
destroy_universe unless all_arguments_valid?
# more code...
and this:
def foo(x, y, z)
destroy_universe if not all_arguments_valid?
# more code...
really have the same implications? "unless" makes it sound a tiny bit as if "all_arguments_valid?" was the exception - to me at least. Does anyone else use "if not" based on this gut feeling sometimes?
- extension 15y agoAs a native English speaker, I would say that "unless" usually implies that the condition is exceptional, which is why I try to avoid code like "handle_error unless there_is_no_error".