Exercise: Repeating Conditional Operations
Enhance your Kotlin skills by practicing conditional operations and loops based on variable types.
We'll cover the following...
Problem statement
You are given two variables:
val num: Any = 42val str: Any = "Hello, Kotlin!"
Perform the following conditional operations based on the types of the given variables:
If
num
is of typeInt
and greater than 50, multiply it by 2 and print the result.If
num
is of typeInt
orLong
, concatenate it ...