You are simply printing the array and the description
method of Array
will show the list of values separated by commas with the brackets.
If you want any other output you need to generate it yourself.
Replace your current print
with the following:
let line = table.map { String(format: "%4d", $0)}.joined()
print(line)
This maps the array of Int
into an array of String
and then joins those strings into a single string with no separator between them. Each Int
is formatted into a String
that will take four spaces and the number will be right-aligned within those four spaces. Adjust as needed.
3
solved Table of integers right aligned