views:

68

answers:

3

Hi!

I'm trying out Ruby koans and found some tests using this _n_ , never seen it before what is it and how do I use it?

Example:

def test_objects_have_methods
           fido = Dog.new
           assert fido.methods.size > _n_
end

// John

+1  A: 

It's just a variable. Variable names in ruby can use underscores (even at fist and last positions). Try ctrl-clicking it in your IDE and you'll probably see its declaration.

Nikita Rybak
A: 

Are you sure that _n_ isn't one of the "fill in the blanks" parts?

Andrew Grimm
Your right, found it myself.
John Doe
A: 

Found it:

 # Numeric replacement value.
    def _n_(value=999999, value19=:mu)
      if RUBY_VERSION < "1.9"
        value
      else
        (value19 == :mu) ? value : value19
      end
    end
John Doe