brewersfan1976

add_border.rb

Mar 28th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.42 KB | None | 0 0
  1. def addBorder(picture)
  2.     array = Array.new
  3.     x = 0
  4.     string = ""
  5.     y = 1
  6.    
  7.     while (x < picture[0].length + 2)
  8.           string = string + "*"
  9.           x = x + 1
  10.     end
  11.    
  12.     array[0] = string
  13.     x = 0
  14.    
  15.     while (x < picture.length)
  16.           array[y] = "*" + picture[x] + "*"
  17.           x = x + 1
  18.           y = y + 1
  19.     end
  20.    
  21.     array[y] = string
  22.    
  23.     return array
  24. end
Advertisement
Add Comment
Please, Sign In to add comment