/**
 * This exercise tests your understanding of identity comparison and equality in Kotlin.
 *
 * Given two variables x and y, write a function that performs the following operations:
 *
 * 1. Check if x and y refer to the exact same object.
 * 2. Check if the values of x and y are equal.
 * 3. Check if the types of x and y are the same.
 * 4. If all of the conditions above are true, return true. Otherwise, return false.
 *
 * Example:
 * identityEqual(5, 5) => true
 * identityEqual(5, 6) => false
 * identityEqual(5, "5") => false
 * identityEqual(5, 5.0) => false
 *
 * Note:
 * - You are not allowed to use the built-in '===" operator for this exercise.
 * - You may assume that the inputs will always be of valid types.
 */
fun identityEqual(x: Any, y: Any): Boolean {

    // Compare identity
    if (System.identityHashCode(x) == System.identityHashCode(y)) {
        // Compare equality
        if (x == y) {
            // Compare types
            if (x::class == y::class) {
                return true
            }
        }
    }
    return false
}
/**
 * This exercise tests your understanding of identity comparison and equality in Kotlin.
 *
 * Given two variables x and y, write a function that performs the following operations:
 *
 * 1. Check if x and y refer to the exact same object.
 * 2. Check if the values of x and y are equal.
 * 3. Check if the types of x and y are the same.
 * 4. If all of the conditions above are true, return true. Otherwise, return false.
 *
 * Example:
 * identityEqual(5, 5) => true
 * identityEqual(5, 6) => false
 * identityEqual(5, "5") => false
 * identityEqual(5, 5.0) => false
 *
 * Note:
 * - You are not allowed to use the built-in '===" operator for this exercise.
 * - You may assume that the inputs will always be of valid types.
 */
fun identityEqual(x: Any, y: Any): Boolean {
/**
 * This exercise tests your understanding of identity comparison and equality in Kotlin.
 *
 * Given two variables x and y, write a function that performs the following operations:
 *
 * 1. Check if x and y refer to the exact same object.
 * 2. Check if the values of x and y are equal.
 * 3. Check if the types of x and y are the same.
 * 4. If all of the conditions above are true, return true. Otherwise, return false.
 *
 * Example:
 * identityEqual(5, 5) => true
 * identityEqual(5, 6) => false
 * identityEqual(5, "5") => false
 * identityEqual(5, 5.0) => false
 *
 * Note:
 * - You are not allowed to use the built-in '===" operator for this exercise.
 * - You may assume that the inputs will always be of valid types.
 */
fun identityEqual(x: Any, y: Any): Boolean {

    // Compare identity
    if (System.identityHashCode(x) == System.identityHashCode(y)) {
        // Compare equality
        if (x == y) {
            // Compare types
            if (x::class == y::class) {
                return true
            }
        }
    }
    return false
}