Quick actions

cmd+k|ctrl+k

Navigation

Languages

If Expression With and , Or

Snippet info

Language

Kotlin

Visibility

public

Author

habib17

Created

2019-10-31T12:47:01Z

Updated

2019-10-31T12:47:01Z

fun main(args : Array<String>){
   negation()
}

fun myStyle(){
    val officeOpen = 7
    val officeClosed = 16
    val now = 20
    val isOpen : Boolean
    if(now >= officeOpen && now <= officeClosed){
        isOpen = true
        print("Office is open : $isOpen")
    }
    else{
        isOpen = false
        print("Office is open : $isOpen")
    }
}

fun dicodingStyle(){
    val officeOpen = 7
    val officeClosed = 16
    val now = 20
    
    val isOpen = now >= officeOpen && now <= officeClosed
    
    println("Office is open : $isOpen")
}

fun disjunctionOfficeClose(){
    val officeClosed = 16
    val officeOpen = 7
    val now = 20
    
    val isOpen = now < officeOpen || now > officeClosed
    
    print("Office is closed : $isOpen")
}

fun negation(){
    val officeOpen = 7
    val now = 10
    val isOpen = now > officeOpen
    
    if(!isOpen){
        print("Office is closed")
    }
    else{
        print("Office is open")
    }
}
INFO