main logo
Subject: RE: [OT] RE: [ProPython] Switching back and forth
Author: "Crooks, David L."
Posted: 2004/11/30 16:18:05
 
View Entire Thread
New Search


Yes, the code needs to be indented. How do I know #2 SET ORDER is not
supposed to be indented? With the ENDIF the IF is complete.

Just don't use tabs for indenting code! 8-)

-----Original Message-----
From: propython-bounces /at/ leafe .DOT com [mailto:propython-bounces@leafe.com]
On Behalf Of Ed Leafe
Sent: Tuesday, November 30, 2004 4:08 PM
To: ProPython Email List
Subject: Re: [OT] RE: [ProPython] Switching back and forth

On Nov 30, 2004, at 3:15 PM, Crooks, David L. wrote:

> For me the END* commands are more complete visually.

I would agree when whitespace and indentation don't matter -
otherwise, how do you know when the conditional block ends?

IF SomeCondition
lcBar = TRANSFORM(someValue)
REPLACE foo WITH lcBar
ENDIF
SET ORDER TO FooBar

However, once you add indenting, the ENDIF is redundant. Do you
think that #1 is visually more complete than #2?

#1
IF SomeCondition
lcBar = TRANSFORM(someValue)
REPLACE foo WITH lcBar
ENDIF
SET ORDER TO FooBar

#2
IF SomeCondition
lcBar = TRANSFORM(someValue)
REPLACE foo WITH lcBar
SET ORDER TO FooBar

Many other languages use braces to denote a block instead of an
END* command; again, all of these don't consider whitespace. I think the
use of indentation to denote code blocks, which is something we should
all be doing with our code anyway, is a brilliant design decision.

___/
/
__/
/
____/
Ed Leafe
http://leafe.com/
http://dabodev.com/


 
©2004 Crooks, David L.
<-- Prior Message New Search Next Message -->