View Single Post
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old March 6th, 2023, 01:59 PM
My usual trick for this sort of thing is to count "if" statements as +1, and endif as -1, and then you figure out why your total is not 0 at the end. (elseif and else are +0). Also, if you ever go negative along the way, right there is your error, because every if must be closed by an endif, so there will never be more endifs than ifs.

Indentation also helps a lot - in this forum, in the advanced mode, there's a code option you can encapsulate all the code in, and then it'll preserve the indentation. That's really helpful for matching the if statements with the endifs that stop them.

Last edited by Mathias; March 6th, 2023 at 02:03 PM.
Mathias is offline   #2 Reply With Quote