Re: Why end for, end if, end while? Here's why I think...

new topic     » goto parent     » topic index » view thread      » older message » newer message
bryanso said...

With such nicely indented code a simple end is enough.

Jeremy's example is contrived. If all blocks are whiles:

while complex-condition1 do 
    ... 
    while complex-condition2 do  
        ... 
        while complex-condition3 do 
            ...  
            lengthy code 
            .... 
        end while 
    end while 
end while 


then one can still argue which end while is matching with which while do.

Bryan

Which is why I would use comments in such a case:

while complex-condition1 do 
    ... 
    while complex-condition2 do  
        ... 
        while complex-condition3 do 
            ...  
            lengthy code 
            .... 
        end while -- complex-condition1 
    end while -- complex-condition2 
end while -- complex-condition3 


new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu