...

/

Exercise: Repeating Conditional Operations

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 = 42
val str: Any = "Hello, Kotlin!"

Perform the following conditional operations based on the types of the given variables:

  1. If num is of type Int and greater than 50, multiply it by 2 and print the result.

  2. If num is of type Int or Long, concatenate it ...