PHP to Ruby
Convert PHP code into Ruby!
-
printf
Posted on April 23rd, 2009 No commentsOutput a formatted string.
PHP
$format = 'There are %d monkeys in the %s'; printf($format, 5, 'tree'); // => There are 5 monkeys in the tree
Ruby
my_string = 'There are %d monkeys in the %s'; printf(my_string, 5, 'tree'); # => There are 5 monkeys in the tree
Leave a reply


