Programming Fundamentals/Arrays/Swift

// This program uses arrays to display temperature conversion tables // and temperature as an array subscript to find a given conversion.//// References:// https://www.mathsisfun.com/temperature-conversion.html// https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.htmlimportFoundationfuncbuildC(size:Int)->[Double]{varc=[Double]()varvalue:Doubleforindexin0...size{value=Double(index*9)/5+32c.append(value)}returnc}funcbuildF(size:Int)->[Double]{varf=[Double]()varvalue:Doubleforindexin0...size{value=Double((index-32)*5)/9f.append(value)}returnf}funcdisplayArray(name:String,array:inout[Double]){forindexin0...array.count-1{print(name+"["+String(index)+"] = "+String(array[index]))}}funcfindTemperature(c:inout[Double],f:inout[Double]){vartemp:Intvarsize:Intsize=minimum(value1:c.count,value2:f.count)repeat{print("Enter a temperature between 0 and "+String((size-1)))temp=Int(readLine(strippingNewline:true)!)!}whiletemp<0||temp>size-1print(String(temp)+"° Celsius is "+String(c[temp])+"° Fahrenheit")print(String(temp)+"° Fahrenheit is "+String(f[temp])+"° Celsius")}funcminimum(value1:Int,value2:Int)->Int{varresult:Intifvalue1<value2{result=value1}else{result=value2}returnresult}funcmain(){varc=buildC(size:100)varf=buildF(size:212)displayArray(name:"C",array:&c)displayArray(name:"F",array:&f)findTemperature(c:&c,f:&f)}main()