0 votes
in Swift by
How to add an element into an Array?

1 Answer

0 votes
by
Arrays are one of the most used data types in an application (app). We use arrays to organize our application (app) data.

Swift makes it easy to create an array in our code using an array literal. Array elements are simply surrounded by a comma and the list of values is separated with square brackets.

For Example,

// Add ‘Int’ elements in an Array

let natural number = [1, 2, 3, 4, 5, 6, 7]

// Add ‘String’ elements in an array

let countryName = [“India”, “Japan”, “Malaysia”, “Peru”, “Russia”]

Related questions

0 votes
asked Feb 7, 2020 in JAVA by rajeshsharma
0 votes
asked Mar 2, 2020 in ReactJS by RShastri
...