1

I am using buildr and I am trying to print all of my command line arguments to standard out. I have been unable to find much documentation on the print function for buildr or for rake (which buildr was built from). I already have the following:

print('Server at ip address' + SERVER)

where SERVER is the variable I store the command line argument from. The problem is that I want it on its own line and adding a '\n' after SERVER doesn't seem to do anything. Anyone know the best way to do this?

mikewied
  • 5,273
  • 1
  • 20
  • 32

1 Answers1

3

I figured it out. Use puts instead of print as follows.

puts "Server at ip address #{SERVER}"

mikewied
  • 5,273
  • 1
  • 20
  • 32
  • 2
    Glad you figured it out. For future reference, the reason why adding `'\n'` after SERVER didn't work is that ruby only evaluates escapes in double-quoted strings. So this would work, too: `print 'Server at ip address ' + SERVER + "\n"`. `puts` is the more idiomatic way to do this, though. – Rhett Sutphin Jun 30 '11 at 13:01