I am having problems with the 3 part of the question in the mini exercise.
Declare a constant tuple that contains three Int values followed by a Double. Use this to represent a date (month, day, year) followed by an average temperature for that date.
Change the tuple to name the constituent components. Give them names related to the data that they contain: month, day, year and averageTemperature.
In one line, read the day and average temperature values into two constants. You’ll need to employ the underscore to ignore the month and year.
so far I have let avgTemperature:(day: Int, month: Int, year: Int, averageTemperature: Double) = (9, 5, 1982, 77.6)
What is meant by reading the day and average temperature values into two constants?
// #1 - Declare a type alias for the myDate tuple
typealias myDate = (Int, Int, Int, Double)
// #2 - Declare a constant tuple birthdate with my data giving them their names
let birthdate: myDate = (day: 12, month: 6, year: 1962, averageTemperature: 12.34)
print(birthdate)
// #3 Read the day and average temp and ignore the others using '_'
let (day, _ , _ , averageTemperature) = birthdate
print(day, averageTemperature)