Speed up development with full-stack environments for every branch.

Learn More

I love Matt. [Ruby and vday]

Forked from Say happy Valentines Day with a heart in Ruby.

75 Runs 82 Views 8 Copies

Tell that special someone happy Valentines Day in Ruby



Jldickenson 1

published 4 years ago

name = "Matt";

l=->a,b=28,c=1{puts (("Love"*a).center(b))*c};

puts "\n    Happy Valentines Day";

# We need to center the name so add some whitespace logic here
whiteSpaceNeedTaken = 28-name.length;
# find out how much we need on each side
splitWhiteSpace = whiteSpaceNeedTaken/2;
leftSpace = splitWhiteSpace;
puts " " * leftSpace + name;
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).