[Closed] finding lose parenthesis
I was wondering if any of you have any tricks of the trade as far as finding open parentheses?
I’ve gone up and down my script and I still cant find the reason why its giving me an expected rollout clause…
Man!! this is just not my week!
Found the problem: forgot to copy over two of my “On button pressed” events, but I had the consequence there despite that…
Okay, I swear I am going to wait at least 6 hours before posting a problem from now on…
But, you know what that means… That means I’m going solve the problem six hours later on my own…
-=drats=-
to check paranthesis :
put the cursor just before the bracket and press CTRL B,
it should select all code in that bracketed loop/block.
if it doesn’t, then you know that something’s wrong within that block
He, don’t waste 6 hours working before posting.
Some tips on finding paranthesises.
First use the Ctrl+B as suggested above. However often this doesn’t help that much.
- Execute the code one step at a time. Basically select a few functions in a time. If this is in a rollout it won’t work.
But NOTE. You shouldn’t have that much code in the rollouts anyway. It should always call functions outside. No functions should generally exist inside the rollout. Generally I think people abuse the rollouts and puch far too much crap in them, and rollouts are strange creatures in several ways. - Comment out code. This is the best tip. Just comment code untill it doesn’t crash again. (by using /* and */). Then you begin to slowly take away the commenting until it crashes again. And there is your problem.
- if … DO when it should be if … THEN is a common problem areas connected to this problem, make sure than you have THEN if you need it.
- Don’t always trust the commenting. if you do nested /* and */ this may cause the commenting to fail so that you suddenly have sections of the code that should be commented actually running.
- I often miss strings. For example print ((array[1] as string +“Variable1:”+variable1 as string) The paranthesis should be behind the first ‘as string’ in this case but was forgotten.
Hope that helps
/Andreas
thanks for the tips, both of you.
I really didnt know about the if/do thing, or the CTRL+B. will be very useful in the future.
You could also try 3rd party editors. I personally use PSPad it offers Paranthesies highlighting. Select a “(” and it will highlight the end “)” this can help narrow down where it may be missing.
-Eric