ios - How to show all the elements of an array in swift? -


i have array this: var array = ["chinese","italian", "japanase", "french" , "american"]

and want print out seperate elements on new line.

how can this?

you can iterate through array , print out elements on new line:

for element in array {   println(element) } 

update

for swift 2 , swift 3:

for element in array {   print(element) } 

or if want on same line:

for element in array {   print(element, terminator: " ") } 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -