Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def create2DArray(lengths)
- output = Array.new(lengths.length){Array.new([])}
- array_length = lengths.length
- x = 0
- y = 0
- z = 0
- while (x < array_length)
- while (y < lengths[x])
- output[z][y] = y
- y = y + 1
- end
- y = 0
- x = x + 1
- z = z + 1
- end
- return output
- end
Advertisement
Add Comment
Please, Sign In to add comment