25 ms·
Or a slightly more direct translation is: result = if baz > 10 foo else bar end
by spicyj 16y ago
Or a slightly more direct translation is:
result = if baz > 10
foo
else
bar
end
- Dylan16807 16y agoresult = case when baz>10 then foo else bar end is a translation of if baz>10: result = self.foo() else: result = self.bar() while result = if baz > 10 foo else bar end is a translation of result = self.foo() if baz>10 else self.bar() It's true that some things have to be changed when translating, but you can't ignore the deliberate structure of the original. Let's say I want to look at how inter-sentence objects work in two languages. I give you the phrase: "Raining cats and dogs. This is what the weather is like." You can't translate it as if it said "It's raining cats and dogs" without losing the basis of comparison entirely.