Well, you handle IF’s loosely like this:
if (condition) {
// Do something... When condition is true
} else {
// Do something else... When condition fails
}
if (condition1) { // nested if's
// Do condition true stuff...
if(condition2) {
// do secondary possible code...
} else {
// Still inside true condition 1, do other false stuff for condition 2
}
} else {
// do condition1 false stuff...
}
Your code is messy. You ASSIGN a substr which is not possible. “=” means ASSIGN “==” means compare or actually IF-EQUAL-TO. I will guess you meant to use ==… But, it is very hard to follow your code as you do not use paren’s much… { } They group code to run when the results of a condition false or true. You have just a pile of run-on code. Hard to read and very hard to debug…
But, my guess is a spelling error … == not = …