| View previous topic :: View next topic |
| Author |
Message |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Sat Mar 29, 2003 6:36 am Post subject: colour coded IF... END |
|
|
i'd like the IF and END to be correspondingly colour coded as when i have nested loops i find it hard to know which END belongs to which IF...even with the tabbing of the IF and THEN...gggrrrr!!!!
Serge _________________
|
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Mar 29, 2003 9:19 am Post subject: |
|
|
This might not help much (unless you're absolutely lost in your
code), but my code checker has an option that sorts code pairs
(IF/END, REPEAT/UNTIL, etc.) and indents them with line numbers
in a list. It's accurate if there's no missing ones...
http://www.vdsworld.com/forum/viewtopic.php?t=1322
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Mar 29, 2003 12:18 pm Post subject: |
|
|
Maybe you should use a good syntax like this. I always go two spaces to the right after an if or repeat command.
| Code: | if @equal(a,b)
info 1
else
repeat
if @equal(t,y)
info 2
else
info 3
end
until @equal(b,c)
end |
|
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Mar 29, 2003 4:25 pm Post subject: |
|
|
'My way' was intended to be used while you are making your code, so that you don't need Tommy's ScriptFormatter...  |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sat Mar 29, 2003 4:28 pm Post subject: |
|
|
Yes, Skit, you're absolutely right. You should always try to write
your code neatly in the first place and then you don't need to use the
ScriptFormatter.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sat Mar 29, 2003 4:32 pm Post subject: |
|
|
Hi Serge,
One thing I do when I get into a seriously nested bunch of code is to keep
an eye on the "Col:" indicator in the IDE's statusbar.  _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Sat Mar 29, 2003 10:24 pm Post subject: |
|
|
thanks for your thoughts and suggestions
i do indent all my IF and END and REPEAT and UNTIL but sometimes i have so many of them nested that it's hard to keep track of them
and i also use the COL indicator but it's all too hard to keep track
i just think that if they were colour coded by the ide, then you could tell at a glance which are paired up
the main problem is when the nesting occurs beyond a screen length and i have to scroll, then i really get confused sometimes
i have even resorted to printing the code and pairing them up with a pen to make sure that they are paired up properly
i am not so much worried about a missing END as i am about the END being in the wrong part of the code because i usually pair them at the right time
and when i nest some more and make changes...gggrrrr!!!
thanks again
Serge _________________
|
|
| Back to top |
|
 |
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Sun Mar 30, 2003 12:09 am Post subject: |
|
|
Personally I would find the following indention better, as it clearly shows which "else"/"end"/"until" belongs to which "if"/"repeat":
| Code: |
if @equal(a,b)
info 1
else
repeat
if @equal(t,y)
info 2
else
info 3
end
until @equal(b,c)
end
|
I think the above method of indention is the standard one too used by almost everyone.
| Skit3000 wrote: | Maybe you should use a good syntax like this. I always go two spaces to the right after an if or repeat command.
| Code: | if @equal(a,b)
info 1
else
repeat
if @equal(t,y)
info 2
else
info 3
end
until @equal(b,c)
end |
|
|
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sun Mar 30, 2003 12:40 am Post subject: |
|
|
I'm afraid I'd have to agree with Tommy, as that method works quite well
for me.
To be honest, I tend to go a little overboard at times it seems when I'm
working in some other kind of document that isn't spaced properly or
easily read. I usually end up going thru it straightening it up.  _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Sun Mar 30, 2003 12:48 am Post subject: |
|
|
ditto! i usually use Tommy's method and i always line things up properly (like you bweckel)...looks untidy and messy otherwise...and i can make sense of the code if it's untidy and messy...we are allowd to be somewhat eccentric aren't we?!!??
Serge _________________
|
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1566
|
Posted: Sun Mar 30, 2003 1:06 am Post subject: |
|
|
| Agreed, why would you 'nest' the else command within the IF section? Obviously it's doing code that the IF portion is not so it would be (from my point of view) logical to place it outside of the code block of the IF statement. |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sun Mar 30, 2003 1:45 am Post subject: |
|
|
| Quote: |
| Code: |
if @equal(a,b)
info 1
else
repeat
if @equal(t,y)
info 2
else
info 3
end
until @equal(b,c)
end
|
|
This is the method I was referring to and prefer to utilize.  _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sun Mar 30, 2003 2:02 am Post subject: |
|
|
I think Prakash was agreeing with you:
| PGWARE wrote: | | Agreed, why would you 'nest' the else command within the IF section? |
_________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
|