Forum: Ruby Problem with beginner project

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
5753b89348af1bf43068eb7e416e8c87?d=identicon&s=25 Coralie R. (cocorigow)
on 2016-12-11 17:33
I have a problem with the project 4 of Ruby for Kids. Could some one
please help me? I am trying to draw a rectangle but it is only printing
the top and bottom lines of the rectangle with nothing in the middle.
Thank you very much.

# Drawing a rectangle
puts "Welcome to Shapes"
print "How big is your rectangle? "
shape_size = gets
shape_size = shape_size.chomp
print "Outside letter: "
outside_letter = gets
outside_letter = outside_letter.chomp
print "Inside letter: "
inside_letter = gets
inside_letter = inside_letter.chomp
puts "About to draw a shape #{shape_size} big"
puts "using #{outside_letter}for the edge"
puts "and #{inside_letter} for the inside"
height = shape_size.to_i
width = shape_size.to_i
1.upto(height) do |row|
# Drawing Code goes here
if row  == 1
  puts outside_letter * width
elsif row == height
  puts outside_letter * width
  middle = inside_letter * (width - 2)

This results in only displaying the top and bottom line of the rectangle
with no filling:
D:\development\project02>ruby shapes.rb
Welcome to Shapes
How big is your shape? 6
Outside letter: x
Inside letter: o
About to draw a shape 6 big
using xfor the edge
and o for the inside

3a81ced4012650ca2004c9bff7b18202?d=identicon&s=25 Ronald F. (rovf)
on 2016-12-12 14:33
I think you have in the 'else' part the puts and the string to put in
different lines.

Aside from this, the program looks correct.
5753b89348af1bf43068eb7e416e8c87?d=identicon&s=25 Coralie R. (cocorigow)
on 2016-12-12 18:12
Thank you so much :)
This topic is locked and can not be replied to.