Guest User

Untitled

a guest
May 27th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. def print_rechteck(x, y, breite)
  2. start = Time.now
  3. y.times do |ay|
  4. arr = Array.new(x, " ")
  5. if ay < breite or ay >= y - breite
  6. puts "#" * x
  7. else
  8. ((1..breite).to_a + ((x - breite + 1)..x).to_a).each {|i| arr[i-1] = "#"}
  9. puts arr.join
  10. end
  11. end
  12. puts Time.now - start
  13. end
  14. print_rechteck(120,1000,2)
Add Comment
Please, Sign In to add comment