Ruby - print the variable name and then its value

Posted by tyndall on Stack Overflow See other posts from Stack Overflow or by tyndall
Published on 2010-04-08T21:34:14Z Indexed on 2010/04/08 21:43 UTC
Read the original article Hit count: 274

Filed under:
|
|

What is the best way to write a function (or something DSLish) that will allow me to write this code in Ruby. How would I construct the function write_pair?

username = "tyndall"
write_pair username
# where write_pair username outputs 

username: tyndall

Is it possible to do? Looking for the most simple way to do this.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about functions