Quick actions

cmd+k|ctrl+k

Navigation

Languages

If else

Snippet info

Language

Kotlin

Visibility

public

Author

habib17

Created

2019-08-07T12:20:12Z

Updated

2019-08-07T12:20:12Z

fun main(args : Array<String>){
    val openHours = 7
    val now = 7
    val office : String
    /*
    if(now > openHours){
        office = "Office already open"
    }
    else{
        office = "Office already closed"
    }
    print(office)*/
    
    //use if else
    office = if (now > openHours){
        "Office already open"
    }
    else if(now == openHours){
        "Wait a minute office will be open"
    }
    else{
        "Office is close"
    }
    
    print(office)
}
INFO