// ArrayDemo.swift Copyright (c) Kari Laitinen // http://www.naturalprogramming.com // 2014-09-24 File created. // 2015-10-16 Converted to Swift 2. // 2016-11-04 Converted to Swift 3. import Foundation // The following statement creates an array that contains only one element. // Subsequent statements append more elements to the array. var array_of_integers = [ 333 ] array_of_integers = array_of_integers + [ 33 ] array_of_integers = array_of_integers + [ 3 ] array_of_integers = array_of_integers + [ array_of_integers[ 2 ] + 2 ] var integer_index = 0 for integer_index in 3 ... 49 { array_of_integers.append( array_of_integers[ integer_index ] + 2 ) } print( "\n The contents of \"array_of_integers\" is:" ) for integer_index in 0 ... 49 { if ( integer_index % 10 ) == 0 { print( "\n" ) } print( String( format: "%5d", array_of_integers[ integer_index ] ), terminator: "" ) } print( "\n" ) ;