I have a Scala case class with the following declaration:
case class Student(name: String, firstCourse: String, secondCourse: String, thirdCourse: String, fourthCourse: String, fifthCourse: String, sixthCourse: String, seventhCourse: String, eighthCourse: String)
Before I create a new Student object, I have a variable holding the value for name and an array holding the values for all 8 courses. Is there a way to pass this array to the Student constructor? I want it to look cleaner than:
val firstStudent = Student(name, courses(0), courses(1), courses(2), courses(3), courses(4), courses(5), courses(6), courses(7))