Write a function processData that takes a parameter of the type String | Int and performs different actions. If the parameter is a String, it should return the length of the string (converted to a string). If it is an Int, it should return even or odd depending on the number.
Unified types
Parse please
Report a typo
Sample Input 1:
8Sample Output 1:
evenWrite a program in Scala 3
def processData(data: String | Int): String =
??? // Write your code here
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.