1 Replies Last post: Mar 23, 2014 9:33 PM by Stavros Kefaleas  
Stavros  Kefaleas Newbie 97 posts since
Feb 8, 2007
Currently Being Moderated

Mar 23, 2014 4:49 PM

Center method is not working

I have created a small program that uses center to put some asterisks around a string but I don't get any asterisks in the results.

Here is the code :

 

name1 = 'larry'
name2 = 'curly'
name3 = 'moe'

health1 = 60
health2 = 125
health3 = 100

puts "#{name1.capitalize}'s health is #{health1}."
puts "#{name2.upcase} has a health of #{health2}."

stringVariable = "#{name3.capitalize} has a health of #{health3}."

puts stringVariable.center(20, '*')

 

 

And here is the console output :

 

Larry's health is 60.

CURLY has a health of 125.

Moe has a health of 100.

 

Process finished with exit code 0

More Like This

  • Retrieving data ...