Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Some 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: ...


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: