Computer scienceProgramming languagesScalaTypes and data structuresSpecial types

Unified types

Check a type

Report a typo

Write a function called checkValueType that takes a parameter value of type Any and determines its value type by returning "AnyVal" or "AnyRef". For simplicity, you have to handle only Int, Double, String types of values.

Sample Input 1:

1 2.0 text

Sample Output 1:

AnyVal
AnyVal
AnyRef
Write a program in Scala 3
def checkValueType(values: List[Any]): List[String] =
??? // Write your code here
___

Create a free account to access the full topic