Re: Can we simplify "end"?
- Posted by Al Getz <Xaxo at aol.c?m> Aug 08, 2007
- 595 views
Bryan So wrote: > > I think it is quite redundant to use different endings for > > end procedure > end function > end if > end while > > etc... > > with proper indentation, which I am sure we all use, one > > end > > should be enough to end a loop or condition or function, etc, > without any ambiguity. > > Bryan Hi Bryan, It is true that you can deduce logically exactly which 'end' goes to which 'for', 'while', 'if', etc., which means that the compiler can be made to do this. The compiler, however, is not the only consideration here as the program maintenance comes into play also. It's still true that it can get confusing even when using the full syntax "end for" instead of "end" but it does help a little. Note that for really big sections of code we have to annotate anyway: for k=1 to 3 do if y=1 then x=CallMyFunction(() if z=2 then --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line --next program line end if --if z=2 end if --if y=1 end for --k In the case of the long code body it always helps to annotate to make it easier when we go to add some code. Take care, Al E boa sorte com sua programacao Euphoria! My bumper sticker: "I brake for LED's" From "Black Knight": "I can live with losing the good fight, but i can not live without fighting it". "Well on second thought, maybe not."