If statement in Swift 3 using OR || operator

8.1k views Asked by At

How should I use the If statement using OR || operator in Swift 3

if (oName.text="" || oWeight.text="")
{
    print("Field Empty")

}
1

There are 1 answers

0
Rich On BEST ANSWER

You're assigning instead of checking for equality...

if (oName.text == "" || oWeight.text == "") {
    print("Field Empty")
}