3 ms·
I think they should keep the "end"s, but they should say what they end! "end function" tells me that a function ends here. "end if" tells me that an if statemen
by tormeh 12y ago
I think they should keep the "end"s, but they should say what they end! "end function" tells me that a function ends here. "end if" tells me that an if statement ends here. "end" is just equivalent to "}".
- k__ 12y ago> "end" is just equivalent to "}". And an unnecessarily verbose one.
- yellowapple 12y agoSome Ruby (and Elixir and Julia and other languages that use `end`) will just add a comment at the end of the `end` if they want to be more explicit about it. For example: def foo(bar,baz) do ... end # foo This brings me to why a bare `end` makes more sense (in the case of Elixir, at least): because every use of `end` corresponds to a `do`. The above code is basically equivalent to `def foo(bar,baz) { ... }`, since `def` takes a function specifier and a block as its arguments. If you really don't like `end`, you can also (at least with Elixir) use the shorthand form: def foo(bar,baz), do: ...