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 80 Views 8 Copies

Tell that special someone happy Valentines Day in Ruby

Saved

Saved

Jldickenson 1

Jldickenson
published 3 years ago

name = "Matt";


l=->a,b=28,c=1{puts (("Love"*a).center(b))*c};
l.call(2,14,2);
l.call(3,14,2);
[7,7,7,6,5,4,3,2,1].map{|x|l.call(x)};

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).