PHP to Ruby
Convert PHP code into Ruby!
-
printf
Posted on April 23rd, 2009 1 commentOutput 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
One response to “printf”
-
Almazko July 19th, 2011 at 19:44
RUBY:
puts ‘There are %d monkeys in the %s’ % [5, 'tree']
Leave a reply
-


