'~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub Command1_Click()
Dim i As Integer
Text1.Text = ""
For i = 0 To 9
Text1 = Text1 & i & " - "
Next i
Text1 = Text1 & i
End Sub
'~~~~~~~~~~~~~~~~~~~~~~~~
I receive in my text box "0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10"
What I expected was I to equal 9 when the for next loop completed. But I
receive 10.
This standard? Will the results be the same all the time so I can trust it,
or is this unusual?
Thanks,
David
You should never assume that the loop variable has any specific value after
the loop completes. That can change between versions and definitely changes
between languages so moving code forward or to another language can
introduce bugs.
> For i = 0 To 9
> Text1 = Text1 & i & " - "
> Next i
>
> Text1 = Text1 & i
> End Sub
> '~~~~~~~~~~~~~~~~~~~~~~~~
>
> I receive in my text box "0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10"
>
> What I expected was I to equal 9 when the for next loop completed. But I
> receive 10.
Each time the loop iterates, i gets incremented by one.
When i reaches a number greater than the max (in you case, 9)
then it exits the for
So when you for loop exits, i will be 10
hope this helps,
Doug.
The others told you why this happens, so I'll address whether this is "standard" and the other issues of trust. Yes, it's
absolutely standard, and has been the way MSBasic has functioned for over a quarter-century. Yes, as long as you use MSBasic, you
can trust it.
.NET: It's About Trust!
http://www.mvps.org/vb/tips/stability.htm
Quoted from that site:
"The purpose here is to describe what the term Language Stability means to the author and to others having valuable code assets."
...
"Language Stability is that feature which allows source code to continue to function as originally designed (and tested) over
transitions in compiler/interpreter versions."
That is a very biased opinion that usurps a word's meaning for his own purposes. What he
describes is language constancy. (the quality of being free from change or variation)
Stability (the state or quality of being stable) is in fact what the original poster was looking for.
He wanted to know if a certain syntax is going to produce predictable results, every where it is
used.
The author's statements about stability are mostly all misleading. For example:
"The end result of a stable language is that a Module from one release will compile and run correctly in the next release."
A language that works as designed from one version to the next is consistent. I don't know
why he felt he had to make up his own meanings when there are plenty of words to describe
his frustrations....
Oh well.
LFS
>> .NET: It's About Trust!
>> http://www.mvps.org/vb/tips/stability.htm
>
> Quoted from that site:
>
> "The purpose here is to describe what the term Language Stability
> means to the author and to others having valuable code assets." ...
> "Language Stability is that feature which allows source code to
> continue to function as originally designed (and tested) over
> transitions in compiler/interpreter versions."
>
> That is a very biased opinion that usurps a word's meaning for his
> own purposes. What he describes is language constancy. (the quality
> of being free from change or variation)
Larry, I've said it before, and I'll say it again -- Yer nutz! HTH.
Dan most definitely does *not* advocate against all change. Extension is good.
Redefinition, otoh, is bad. It's _that_ clear.
> Stability (the state or quality of being stable) is in fact what the
> original poster was looking for. He wanted to know if a certain
> syntax is going to produce predictable results, every where it is
> used.
As it should. We had that in quite manageable and measurable ways, with the sole
exception being a few (relatively-speaking) minor tweaks in VB4/32, for a
quarter-century before the latest debacle.net came down.
> The author's statements about stability are mostly all misleading.
> For example:
>
> "The end result of a stable language is that a Module from one
> release will compile and run correctly in the next release."
>
> A language that works as designed from one version to the next is
> consistent. I don't know why he felt he had to make up his own
> meanings when there are plenty of words to describe his
> frustrations....
Nor I, you. WTF are you dribbling on about now?
I am glad, regardless, that by posting this you're inviting others to think it all
over! :-)
Later... Karl
--
[Microsoft Basic: 1976-2001, RIP]
You've apparently been blinded. His is a biased opinion.
> Dan most definitely does *not* advocate against all change. Extension is good.
> Redefinition, otoh, is bad. It's _that_ clear.
I didn't say he didn't want change, I said he misused 'stability'. Like trust, constancy
is not an all or nothing noun. There are degrees which he would have liked to see
maintained. He wanted more constancy, and was whining about stability. Is _that_ clear?
> > A language that works as designed from one version to the next is
> > consistent. I don't know why he felt he had to make up his own
> > meanings when there are plenty of words to describe his
> > frustrations....
>
> Nor I, you. WTF are you dribbling on about now?
Whining is unbecoming to a professional, the fact that you support it on your web site
does not sit well on you either.
You don't think its whining? Consider:
"Given a change of heart by MS on the definition of Visual Basic this author would
be back in the fold so fast it would give one whiplash"
Translation: If they change it the way I want, then I'll come back and play along.
"Language Stability is a Feature. I wish Visual Basic had it. It still could, and I know how to make it happen. If only they
cared…"
Translation: I care about VB more than they do.... (boo hoo)
> I am glad, regardless, that by posting this you're inviting others to think it all over! :-)
I don't mind that, it just seems cruel to post that reference as if it was the last word on
not trusting MS to improve their products for the betterment of all involved. Life isn't
always convenient, nor should it be. You, Dan, MS or I, will not know if it is for the
better or not until several years have passed. MS seems to think they are on the right track,
and many agree. Whining because things don't go your way is not the proper approach
to resolving an issue. If you think it is, then you're nutz!
LFS
>>>> http://www.mvps.org/vb/tips/stability.htm
>>>
>>> Quoted from that site:
>>>
>>> "The purpose here is to describe what the term Language Stability
>>> means to the author and to others having valuable code assets." ...
>>>
>>> That is a very biased opinion
>>
>> Larry, I've said it before, and I'll say it again -- Yer nutz! HTH.
>
> You've apparently been blinded. His is a biased opinion.
Alright, lay out your definition of "biased" and let's see if everyone agrees.
Everyone has opinions. It sounds like you're saying his prevent him from judging
impartially that about which he writes. What expertise do you bring to this
discussion to make such a sweeping accusation?
>> Dan most definitely does *not* advocate against all change.
>> Extension is good. Redefinition, otoh, is bad. It's _that_ clear.
>
> I didn't say he didn't want change, I said he misused 'stability'.
> Like trust, constancy is not an all or nothing noun.
Neither is stability, necessarily. It's a frame-of-reference (FOR) thing, though.
For example, let's use evolution as a way of gauging our ability to think outside our
own FOR. You'd probably say that the creatures roaming earth are fairly (totally?)
stable, correct? From your own FOR? But all we need do is shift FOR to a more
geologic timescale, and we see amazing change over time! As FOR shifts and focuses
in on specific changes, again, we see extreme stability with only subtle variation.
Forward and backward compatability, so to speak. The term for this, in evolutionary
theory, is "punctuated equilibrium". While that may seem like a contradiction in
terms, it's really an eight-bit way to say "stability", specifically, over time.
> There are
> degrees which he would have liked to see maintained. He wanted more
> constancy, and was whining about stability. Is _that_ clear?
Nope. He's not talking about constancy. It's a FOR thing, Larry. You need to
adjust yours. This is not a static world we live in, and most sentient beings
recognize that.
>>> A language that works as designed from one version to the next is
>>> consistent. I don't know why he felt he had to make up his own
>>> meanings when there are plenty of words to describe his
>>> frustrations....
>>
>> Nor I, you. WTF are you dribbling on about now?
>
> Whining is unbecoming to a professional, the fact that you support it
> on your web site does not sit well on you either.
I'm confused. You seem to be the one whining, here. FOR?
> You don't think its whining? Consider:
>
> "Given a change of heart by MS on the definition of Visual Basic this
> author would be back in the fold so fast it would give one whiplash"
>
> Translation: If they change it the way I want, then I'll come back
> and play along.
Dan's profession is not wordsmithing -- he'd be the first to point that out. What
he's done there is make it clear that the product and the product direction are not
ones he would use/follow. Nothing more. Your schoolyard analogy is fanciful, and I
can even understand how one with an axe to grind might trip over that while looking
for anything to criticize, but I do tend to give folks the benefit of the doubt.
> "Language Stability is a Feature. I wish Visual Basic had it. It
> still could, and I know how to make it happen. If only they cared…"
>
> Translation: I care about VB more than they do.... (boo hoo)
Whining? C'mon, man. Sounds like just the opposite to me. <g>
>> I am glad, regardless, that by posting this you're inviting others
>> to think it all over! :-)
>
> I don't mind that, it just seems cruel to post that reference as if
> it was the last word on not trusting MS to improve their products for
> the betterment of all involved.
It's definitely *not* the last word! That was written, what, almost a year ago? And
how many millions more words have you seen since? <bg>
It is a healthy reminder that Trust was violated, however.
> Life isn't always convenient, nor
> should it be. You, Dan, MS or I, will not know if it is for the
> better or not until several years have passed.
Clue: We're at two years and counting, already. If anything, I see the pain and
hostility increasing. You?
> MS seems to think
> they are on the right track, and many agree. Whining because things
> don't go your way is not the proper approach to resolving an issue.
> If you think it is, then you're nutz!
Your opinion is duly noted. It's hard to imagine where you got the idea that I, or
anyone else, felt that paper represented a solution. It does go a long way towards
defining the problem, though.
| MS seems to think they are on the right track,
| and many agree.
^^^^
You misspelled "at least two". HTH.
--
Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.
Highly subjective. And that in my own words. Dictionary.com states:
A preference or an inclination, especially one that inhibits impartial judgment.
(among others)
> Everyone has opinions. It sounds like you're saying his prevent him from judging
> impartially that about which he writes. What expertise do you bring to this
> discussion to make such a sweeping accusation?
Having read english for all of my life. I can't help it if you don't see it as plainly as I do.
>
> >> Dan most definitely does *not* advocate against all change.
> >> Extension is good. Redefinition, otoh, is bad. It's _that_ clear.
> >
> > I didn't say he didn't want change, I said he misused 'stability'.
> > Like trust, constancy is not an all or nothing noun.
>
> Neither is stability, necessarily. It's a frame-of-reference (FOR) thing, though.
I'll agree stability is also not an all or nothing proposition, but your FOR is way off base.
Stabilty refers to an item in its _current state_ constancy refers to an item remaining
the same over _multiple states_. (multiple views).
In this case each state is a new version.
>
> Nope. He's not talking about constancy.
Yes, he is, but he is calling it stability. And you are promoting it, which is why I
responded. I've already told Dan that page isn't worth the electrons it takes to display
(or thereabouts) Seeing you parade it out for a question on classic VB seemed like
pointless subversion, so I decided to challenge it. with a response. Upon reflection,
(re-reading the thread) something like it could have been mentioned in a more
approreate manner. (You could have done without the reference)
>
> Dan's profession is not wordsmithing -- he'd be the first to point that out. What
> he's done there is make it clear that the product and the product direction are not
> ones he would use/follow. Nothing more.
And that is not a biased opinion? I shouldn't have to say anything more, you
have just explained why it is biased.
>
> It is a healthy reminder that Trust was violated, however.
>
>
> Clue: We're at two years and counting, already. If anything, I see the pain and
> hostility increasing. You?
Many people wondered what happened to READ/DATA when they moved from
QBasic to VB, does that mean there was hostility? That sort of thing is happening
again with people who have spent some time learning classic VB and are now trying
to get up to speed on VB.Net. I wouldn't say that is increasing hostility, no. How
about taking a count on dotnet.languages.vb to see how many complaints there are
verses how many 'how to' questions there are? Many are simply trying to put it to
use. You see what you want to see, it doesn't take a PhD to learn thats the way it
is with most everybody....
> > MS seems to think
> > they are on the right track, and many agree. Whining because things
> > don't go your way is not the proper approach to resolving an issue.
> > If you think it is, then you're nutz!
>
> Your opinion is duly noted. It's hard to imagine where you got the idea that I, or
> anyone else, felt that paper represented a solution. It does go a long way towards
> defining the problem, though.
Perhaps it was from his defining a standard that he says will help solve the problem?
Do you think that might be construed as somebody's recommended solution?
I think so....
"In the experience of the author, the Standard below will reduce disruption to a level that can generally be tolerated by an
application product."
None the less, I have made my point. To be more informative, that page needs a major
re-write. With that, I am finished with this discussion. No reply is necessary....
LFS
>> Alright, lay out your definition of "biased" and let's see if
>> everyone agrees.
>
> Highly subjective.
Uh huh. And we should take you seriously, because...? You're saying you "know
[bias] when you see it," eh?
>> Everyone has opinions. It sounds like you're saying his prevent him
>> from judging impartially that about which he writes. What expertise
>> do you bring to this discussion to make such a sweeping accusation?
>
> Having read english for all of my life. I can't help it if you don't
> see it as plainly as I do.
We're not talking English comprehension here. You're accusing someone of something
and I'm asking you to back it up with facts, or take it back.
>>>> Dan most definitely does *not* advocate against all change.
>>>> Extension is good. Redefinition, otoh, is bad. It's _that_ clear.
>>>
>>> I didn't say he didn't want change, I said he misused 'stability'.
>>> Like trust, constancy is not an all or nothing noun.
>>
>> Neither is stability, necessarily. It's a frame-of-reference (FOR)
>> thing, though.
>
> I'll agree stability is also not an all or nothing proposition, but
> your FOR is way off base. Stabilty refers to an item in its _current
> state_ constancy refers to an item remaining the same over _multiple
> states_. (multiple views). In this case each state is a new version.
Try that again, in English?
>> Nope. He's not talking about constancy.
>
> Yes, he is, but he is calling it stability.
Perhaps it's time to return to your initial objection:
>> Quoted from that site:
>>
>> "The purpose here is to describe what the term Language Stability
>> means to the author and to others having valuable code assets." ...
He comes right out and says that he's about to tell you what stability means to
*him*. He defined it in his terms, and you're not only taking issue with that, but
making up definitions for other words you think he should've used instead.
> And you are promoting
> it, which is why I responded. I've already told Dan that page isn't
> worth the electrons it takes to display (or thereabouts) Seeing you
> parade it out for a question on classic VB seemed like pointless
> subversion, so I decided to challenge it. with a response. Upon
> reflection, (re-reading the thread) something like it could have been
> mentioned in a more approreate manner. (You could have done without
> the reference)
Yeah, but it never hurts to remind folks that their trust has been violated. By
drawing this out as you seem wont, you help in that effort. Thanks!
>> Dan's profession is not wordsmithing -- he'd be the first to point
>> that out. What he's done there is make it clear that the product
>> and the product direction are not ones he would use/follow. Nothing
>> more.
>
> And that is not a biased opinion?
Did you mistake that for a technical writing? Devoid of opinion? I hardly think so,
given your initial objection! What you call bias, here, is simply a statement of
fact.
> I shouldn't have to say anything
> more, you have just explained why it is biased.
You're a weaner.
>> It is a healthy reminder that Trust was violated, however.
>>
>> Clue: We're at two years and counting, already. If anything, I see
>> the pain and hostility increasing. You?
>
> Many people wondered what happened to READ/DATA when they moved from
> QBasic to VB, does that mean there was hostility?
I didn't see it then, like I do now, nope. I saw almost universal exhuberance, in
fact.
> That sort of thing
> is happening again with people who have spent some time learning
> classic VB and are now trying to get up to speed on VB.Net.
Not at all. They didn't alter fundamental datatypes then, nor did they redefine
other keywords. Totally different case, and by bringing it up you demonstrate that
you're not to be taken seriously. Get your facts straight first, then argue.
> wouldn't say that is increasing hostility, no. How about taking a
> count on dotnet.languages.vb to see how many complaints there are
> verses how many 'how to' questions there are?
That'd be dumb. The complainants are all here. <g>
>>> MS seems to think
>>> they are on the right track, and many agree. Whining because things
>>> don't go your way is not the proper approach to resolving an issue.
>>> If you think it is, then you're nutz!
>>
>> Your opinion is duly noted. It's hard to imagine where you got the
>> idea that I, or anyone else, felt that paper represented a solution.
>> It does go a long way towards defining the problem, though.
>
> Perhaps it was from his defining a standard that he says will help
> solve the problem? Do you think that might be construed as somebody's
> recommended solution? I think so....
Or it could just be a suggestion towards problem definition. You're pretty binary,
dude.
> "In the experience of the author, the Standard below will reduce
> disruption to a level that can generally be tolerated by an
> application product."
>
> None the less, I have made my point. To be more informative, that
> page needs a major re-write. With that, I am finished with this
> discussion. No reply is necessary....
Too late.
For Counter = Lower To Upper Step Increment
'A series of commands
Next
This is identically equivalent to
Counter = Lower
Do While Counter <= Upper
'A series of commands
Counter = Counter + Increment
Loop
I'm reasonably sure this is what the For-Next loop is "translated" to
internally within VB. Notice that the loop can't end *until* the value
of Counter is GREATER THAN Upper (never when it equals it).
Rick - MVP
"David Henderson" <dhend...@nvtl.com> wrote in message
news:eL01j23eCHA.2416@tkmsftngp10...
That never works!
; )
Les F.
for i=1 to 9
..statements
' i=i+1 This is how the i variable gets incremented so at the ninth
occurence of the loop i's value changes to 10, the loop condition
becomes false and the loop exits but i's value remains what it was
before end of loop that is, 10.
next i
So, you get the value 10 at the end of the loop.
with regards,
J.V.Ravichandran
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
>
>
> > Dan most definitely does *not* advocate against all change. Extension
is good.
> > Redefinition, otoh, is bad. It's _that_ clear.
>
> I didn't say he didn't want change, I said he misused 'stability'. Like
trust, constancy
> is not an all or nothing noun. There are degrees which he would have
liked to see
> maintained. He wanted more constancy, and was whining about stability.
Is _that_ clear?
>
In his paper, Dan chose a word he thought was appropriate, and defined the
term for the purpose of the paper. In doing that, we was doing something
commonly repeated throughout most of technical communication, defining a
technical term with a limited context. The use of "Class", "Module" and
"Form" within VB are defined technical terms in much the same way. It is
just as arguable that "Form" is a confusing term and "Window" or "Dialog"
should be used instead. However, nobody bothers doing that, because "Form"
was the word used by the authors when VB was designed.
If you want to internally think "constancy" every time you read the word
"stability", then that is fine, so long as you translate it back to
"stability" - the term used in the paper itself - when you discuss with
others the issues that Dan raises. Also, you need to ensure, when you change
the word, that you don't attach your own private definition to it, so that
you end up talking about something different from what everyone else is
discussing.
If you don't do that, then you will fail in what I presume to be your
objective, to communicate your own view of the topic with the minimum
confusion and maximum persuasiveness.
--
Regards
Jonathan West
Has Microsoft **ever** let us down? <g>
Rick - MVP
It is not consistent in any language. Some compilers implement loops
No kidding. <g>
<LOL>
Very well put, sir! :-)
> Yes. It is consistent in any language. It is imple to understand.
Not so. I've worked with more than one language, including variants of
BASIC, where the loop variable is unavailable outside the loop, and
unchangeable (shadowed) within it. In languages where the behavior of
the loop variable is actually specified, this is more the norm than the
exception.
It's bad practice to rely on side effects that aren't in the language
specification. In the case of MS Basic there is no language spec, only
a version-specific implementation spec, so it's a bad idea to rely on
anything. :-)
--
Jim Mack
MicroDexterity Inc
www.microdexterity.com