forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


colour coded IF... END

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Sat Mar 29, 2003 6:36 am    Post subject: colour coded IF... END Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Mar 29, 2003 9:19 am    Post subject: Reply with quote

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 Smile

_________________
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
View user's profile Send private message Send e-mail
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sat Mar 29, 2003 12:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sat Mar 29, 2003 1:00 pm    Post subject: Reply with quote

If you don't want to go through all of the work to indent it yourself you can
use Tommy's ScriptFormatter:
http://www.vdsworld.com/archive/index.php?page=topic&board=3&topic=64

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sat Mar 29, 2003 4:25 pm    Post subject: Reply with quote

'My way' was intended to be used while you are making your code, so that you don't need Tommy's ScriptFormatter... Wink
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sat Mar 29, 2003 4:28 pm    Post subject: Reply with quote

Yes, Skit, you're absolutely right. Wink You should always try to write
your code neatly in the first place and then you don't need to use the
ScriptFormatter. Smile

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Sat Mar 29, 2003 4:32 pm    Post subject: Reply with quote

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. Smile

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Sat Mar 29, 2003 10:24 pm    Post subject: Reply with quote

thanks for your thoughts and suggestions Smile

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
View user's profile Send private message Visit poster's website MSN Messenger
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Sun Mar 30, 2003 12:09 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Sun Mar 30, 2003 12:40 am    Post subject: Reply with quote

I'm afraid I'd have to agree with Tommy, as that method works quite well
for me. Smile Shocked
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. Wink Rolling Eyes

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Sun Mar 30, 2003 12:48 am    Post subject: Reply with quote

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?!!?? Smile Smile Smile

Serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1566

PostPosted: Sun Mar 30, 2003 1:06 am    Post subject: Reply with quote

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
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Sun Mar 30, 2003 1:45 am    Post subject: Reply with quote

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. Smile

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sun Mar 30, 2003 2:02 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group