Search code examples
iosswiftcompareint64

How to compare a Int64 with a Int64


I working on a Swift program and now I have a problem:

How do you compare a Int64 with a Int64?

if(msgCount.value != msg.longLongValue){

Error:

Binary operator '!=' cannot be applied to operands of type 'Int64' and 'Int64'

Solution

  • You can directly compare for equality

    Try this, it will help you:

    let msgCount : Int64=100
    let msg : Int64=101
    
    if(msgCount != msg ){
        // perform your logic here.
    }