Page 1 of 2
EndWhile
Posted: Mon Apr 30, 2012 11:55 pm
by USCode
For improved consistency, please consider adding EndWhile as a keyword to end a While loop.
I'm not saying replace Wend, as it's already very well entrenched and in the BASIC tradition, but also allow EndWhile to be used to end a While loop as well.
This is a really minor request and I only request it because I find PureBasic already pretty consistent. We have EndIf, EndSelect, EndEnumeration, EndInterface, EndStructure, EndWith, EndProcedure, EndImport and EndMacro ... the only other termination keyword with "end" in it is Wend ... just seems like EndWhile would be more consistent there.
I know I could always add a macro like this:
But it would be handy to have it built-in to the language.
Again, a minor request but a "nice to have" IMHO.
Re: EndWhile
Posted: Tue May 01, 2012 3:35 am
by kenmo
I think I agree. "Wend" is strange and I don't know what other languages use it. "EndWhile" would be more consistent and intuitive to newcomers.
Although I've been using PB for so long I don't even think twice about typing it anymore!
Re: EndWhile
Posted: Tue May 01, 2012 4:34 am
by juror
kenmo wrote:I think I agree. "Wend" is strange and I don't know what other languages use it.
It's been part of "basic" syntax from the beginning. Why should we care what other languages use? Basic precedes most of them.

Re: EndWhile
Posted: Tue May 01, 2012 10:48 am
by Foz
... so on this line of thought, we should also have EndFor and EndRepeat?

Re: EndWhile
Posted: Tue May 01, 2012 10:52 am
by Demivec
USCode wrote:Again, a minor request but a "nice to have" IMHO.
By way of comment I don't think this request makes sense to have.
Notice the other words you used as examples:
We have EndIf, EndSelect, EndEnumeration, EndInterface, EndStructure, EndWith, EndProcedure, EndImport and EndMacro ... the only other termination keyword with "end" in it is Wend ... just seems like EndWhile would be more consistent there.
I Notice that you left out a few other 'end'-ing keywords. They're all looping words: Next, Until, Forever, and Wend. Would you suggest, for consistency, to use in addition to EndWhile to also moving to EndFor, EndRepeat, EndRepeatALot? That would seem a scary prospect. The alternative of just adding EndWhile and leaving the rest with no 'additions' wouldn't be consistent.
The looping words were chosen (for the most part

) because they make sense, not because they followed a pattern. To be consistent they should be left as they are without the need of any syntatic sugar. You already mentioned how you would do it with a macro if you wanted it (though, if it is for a beginner you've already moved into more advanced territory).
Furthermore, what about other keywords such as Return, or the function names in libraries: StopDrawing(), Stop3D(), StopSpecialFX(), StopPrinting()?
Even though I'm not a newbie and this is a minor request, I still wouldn't be in favor of this (-1).
Re: EndWhile
Posted: Tue May 01, 2012 10:52 am
by Little John
Foz wrote:... so on this line of thought, we should also have EndFor and EndRepeat?

... and "EndForEach" and "EndGosub"

Re: EndWhile
Posted: Tue May 01, 2012 11:08 am
by ts-soft
Re: EndWhile
Posted: Tue May 01, 2012 11:45 am
by MachineCode
kenmo wrote:"Wend" is strange and I don't know what other languages use it.

"While/Wend" is in AutoIt, Visual Basic, PowerBasic, RealBasic, Liberty Basic, QBasic, JustBasic...
Re: EndWhile
Posted: Tue May 01, 2012 5:37 pm
by USCode
Foz wrote:... so on this line of thought, we should also have EndFor and EndRepeat?

No, I wasn't suggesting we have those. For-Next and Repeat-Until, those are understandable words in context.
However, I understand Wend has been around forever and is used in many other BASIC-like languages.
Not that Fred was likely to add it anyways!

Re: EndWhile
Posted: Tue May 01, 2012 7:02 pm
by Tenaja
When someone has a feature request that they feel important enough to post, and others rant about how lame the request is, it is very annoying. Especially when it is a backwards-compatible request that does not force a change upon people. Unfortunately, users on this board are experts at rants like that. Regardless of the reasons, Fred implements changes as he sees fit regardless of the popularity and/or logical improvement we as users see. Couple that with his lack of time (having been doing this "on the side" for the past few years), and in the end, very few "sugar" requests are implemented. Perhaps he'll sweeten PB up for us a bit after he finishes his recently-announced mind-blowing updates, now that he is back on PB "full time."
Having said that, "wend" is likely the single most common way to end a while loop in all basic languages. This is likely one of those time where the syntax may be confusing and/or frustrating when you are learning a new language, but once you give in and get accustomed to it you soon forget it was ever an issue.
When I first started using PB, I made a macro for LocalVar, because I strongly disliked using "Protected." I'd never seen that keyword used before, and wanted something I would recognize quicker. I'd forgotten all about that until last month I ran into some code I wrote early on. I think I only used the macro for a week, maybe two. By the time I saw so many samples in Help, the Forum and in the many library sites, it kind of became second nature. Perhaps wend will become that way for you; in the meantime, be prepared for a long wait, if it ever comes.
Re: EndWhile
Posted: Tue May 01, 2012 7:10 pm
by LuCiFeR[SD]
USCode wrote:For improved consistency, please consider adding EndWhile as a keyword to end a While loop.
I'm not saying replace Wend, as it's already very well entrenched and in the BASIC tradition, but also allow EndWhile to be used to end a While loop as well.
This is a really minor request and I only request it because I find PureBasic already pretty consistent. We have EndIf, EndSelect, EndEnumeration, EndInterface, EndStructure, EndWith, EndProcedure, EndImport and EndMacro ... the only other termination keyword with "end" in it is Wend ... just seems like EndWhile would be more consistent there.
I know I could always add a macro like this:
But it would be handy to have it built-in to the language.
Again, a minor request but a "nice to have" IMHO.
Wend = W(hile)End. Quite logical as it stands don't you think?
Re: EndWhile
Posted: Tue May 01, 2012 7:57 pm
by USCode
LuCiFeR[SD] wrote:Wend = W(hile)End. Quite logical as it stands don't you think?
So then ...
If -> Iend
Select -> Send
Procedure -> Pend
With -> Wend ... (this one in particular illustrates why Wend is a bad idea, but it is what it is)
... no thanks.
Fred's not going to add it anyways, so this is all academic.
Re: EndWhile
Posted: Tue May 01, 2012 9:56 pm
by Tenaja
USCode wrote:Fred's not going to add it anyways, so this is all academic.
I agree.
On the other hand, "wend" sounds like a word, while "iend" does not; "endif" flows smoothly as a word.
In reality, he has clearly chosen his keywords based on existing language syntax.
Re: EndWhile
Posted: Tue May 01, 2012 10:00 pm
by kenmo
MachineCode wrote:
"While/Wend" is in AutoIt, Visual Basic, PowerBasic, RealBasic, Liberty Basic, QBasic, JustBasic...
Fair enough. I've only used a few of those, and not recently... Most of my non-PB experience uses "EndWhile" or just braces.
Demivec has a good point that none of the loop-keywords start with "End", and I was unaware that "Wend" is the most common keyword to end a "While".
But I don't know why everyone is extrapolating one specific keyword suggestion to dozens more keywords. USCode didn't ask to change For/Next (everyone recognizes those) or Repeat/Until/Forever (these are needed to distinguish how the loop repeats) or StopDrawing/Stop3D/etc (these are library functions not keywords) or Return or ForEach or anything else...
By that logic, you could take any Feature Request, expand it into 50 different feature requests, then argue they're unnecessary.
Anyway I am neutral toward adding "EndWhile"... Honestly I would probably still use "Wend" out of habit.
Re: EndWhile
Posted: Tue May 01, 2012 11:03 pm
by Demivec
kenmo wrote:But I don't know why everyone is extrapolating one specific keyword suggestion to dozens more keywords. USCode didn't ask to change For/Next (everyone recognizes those) or Repeat/Until/Forever (these are needed to distinguish how the loop repeats) or StopDrawing/Stop3D/etc (these are library functions not keywords) or Return or ForEach or anything else...
@kenmo: USCode's feature request was made based on a desire/need for consistency.
Demivec wrote:The alternative of just adding EndWhile and leaving the rest with no 'additions' wouldn't be consistent