Can anyone help with this code?

Page 1 of 1

1 Replies - 788 Views - Last Post: 23 January 2017 - 08:39 PM Rate Topic: -----

#1 jstanley6  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 39
  • Joined: 22-January 17

Can anyone help with this code?

Posted 23 January 2017 - 07:53 PM

size = 8
puts " " * (size - 1) + "*"
row = 0
while row < (size - 2) do
  puts " " * (size - row - 1) + "*" + " " * (row - 1) + "*"
  row += 1
end
puts "*" * size



The counter for row += 1 isn't working in the position it is showing there, however if I add it above the 5th line where puts is, it works just fine. Also is there any way to make the code a little more neater? It took awhile doing different things like above, I'm just wondering if there was a quicker way to get to that spot..?

Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Can anyone help with this code?

#2 xclite  Icon User is offline

  • I wrote you an code
  • member icon


Reputation: 1237
  • View blog
  • Posts: 4,029
  • Joined: 12-May 09

Re: Can anyone help with this code?

Posted 23 January 2017 - 08:39 PM

Duplicate:
http://www.dreaminco...-triangle-code/
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1