Solution Review: Make a Diamond
See the solution to making a diamond in Perl.
We'll cover the following...
Solution
Let’s look at the solution before jumping into the explanation:
Press + to interact
# Assume that $n is already definedfor my $i (0..$n){print ' ' x ($n-$i);say 'o' x (2*$i + 1);}for my $i (1..$n){print ' ' x $i;say 'o' x (2*($n-$i) + 1);}
Explanation
Let's go through the solution step by step:
Lines 2–6: We use ...