Question: Write in Scala for the following assignment: Define a function named contains that takes an integer and a list of integers as parameters. The function
Write in Scala for the following assignment:

Define a function named contains that takes an integer and a list of integers as parameters. The function should return true if the element is in the list, false otherwise. For example: contains 3, List 2, 4, 6, 8)) = false contains(9, List()) = false contains(3, List(6, 3, 3, 2)) = true Test your code using the interpreter on stdlinux to check your work. As above, use only the elements we have discussed in class to write this code and your solution must be done without using a while loop. (As an exercise, try implementing this with Scala's match/case syntax instead of using if else)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
