Wednesday, July 20, 2005

Ruby Formats

I've been hacking around in Ruby again and I've started to use a feature I've ignored in the past, the format operator. It's just syntax suger for doing a C style sprintf but I think its makes the code a bit more readable.



s = "My name is %s and I like the number %d" % ["Pete", 7]


Little things like this make me happy.

Post a Comment
 
The Out Campaign: Scarlet Letter of Atheism