I’m having trouble figuring why this isn’t working…
if (index != 10 || index != 0) {
If index = 0 the function is still allowed in, why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When index is zero, it is not ten.
The double pipe is a logical OR operator. The expression returns true when either the left, or the right side is true.
If you intend to return false when index is not 10 and zero, use the logical AND,
&&: