I'm only a few days into learning swift and I've done a bit of research but either don't understand the explanations or I can't find what I'm looking for.
If I have two variable in an if statement, how can I tell if either variable is a nil value.
For example: (syntax is not correct but just giving an idea).
if variable1 or variable2 != nil {
// Do this
} else {
// Do this instead
}
I need to know how to do the 'or' part of it.
I saw somewhere I could use || (2 x pipes) but it didn't work for me.
I would also like to know if the same would work for something other than variables such as.
if inputTextBox1.text or inputTextBox2.text != nil {
// Do this
} else {
// Do this instead
}
Thanks,
Toby
Aucun commentaire:
Enregistrer un commentaire