Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,166 questions

40,722 answers

573 users

How to create an empty 2D array and append rows to it in Swift

1 Answer

0 votes
var arr = [[String]]()

var row1 = [String]()
row1.append("swift")
row1.append("java")

arr.append(row1)

var row2 = [String]()
row2.append("c++")
row2.append("python")

arr.append(row2)

print(arr)




/*
run:

[["swift", "java"], ["c++", "python"]]

*/

 





answered Sep 19, 2020 by avibootz

Related questions

1 answer 75 views
1 answer 63 views
1 answer 81 views
81 views asked Sep 1, 2020 by avibootz
1 answer 26 views
26 views asked Jun 13, 2023 by avibootz
1 answer 77 views
...