News for hackers. Stuff that matters.
Re:IF-less programming by codehalo on Friday December 28, 2012 @10:21AM (#4977976)
I don't like the OP code either. To someone not familiar with this language, || produces a boolean value (true or false), and that value gets assigned to param. A better approach would be (without knowledge of the language in particular):

  def method (object)
    param = default_param
    if object.property
      param = object.property
    end
  end

Here, its clear that param has a default right away.

There are no comments on this comment yet.