Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #37330
| From | John G Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: What does this line of code mean? |
| Date | 2019-09-22 15:40 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <nu1foe53ihg9as4v6hstd0hd80mob58935@4ax.com> (permalink) |
| References | <f27ce718-9b0b-4641-86f1-bfc079462875@googlegroups.com> <vpieoepequgh08bsnrf6qg9g4r48eqfbnh@4ax.com> <b466aef9-f439-478f-9e8b-3968a1dc7c85@googlegroups.com> |
On Sun, 22 Sep 2019 04:53:12 -0700 (PDT), Julio Di Egidio
<julio@diegidio.name> wrote:
>On Sunday, 22 September 2019 12:25:41 UTC+2, John G Harris wrote:
>> On Sat, 21 Sep 2019 11:15:24 -0700 (PDT), groovee@cyberdude.com wrote:
>>
>> >My JS book was explaining Graphs, and in the code for "finding shortest paths using BFS", it had this line:
>> >
>> >blah blah..
>> >for (var v=toVertex; v!== fromVertex; v=shortestPathA.predecessors[v] {
>> > path.push(v);
>> >}
>> >blah blah...
>> >
>> >What is the "for" line doing? I'm especially not understanding the THIRD argument - I always thought the 3rd thing in a "for" HAD to be "something++" or "something--"?? Could someone please explain?
>>
>> Unless you are doing something peculiar, the third term's job is to
>> move along. If v is a number then you add/subtract something. One is a
>> commonly needed amount; that can be done using ++/--.
>>
>> If v is a graph node, then the third term moves v to the next node to
>> be processed. When the next node is the node you started from then
>> it's all done and the for loop exits.
Where did this next quote line come from? It certainly isn't a quote
from the article I posted.
>>>No, the third argument (indeed all the arguments) can be any expression.<<
>Not only the question was already answered and pretty decently so
Jon said what a for statement does; I said why it does it. There's
nothing wrong with that.
Also, who said Jon's article arrived at my News Server in time for me
to see it before posting my reply?
>and you
>just post over it, you piece of shit and resident spammer,
"over" it?? Oh, now I see why you added a line from Jon's article. It
was to pretend that I was overwriting it. That sort of lie is bad for
the group.
>you also and
>always just write utterly retarded bullshit, you utterly stupid fuck.
If you seriously think that what I wrote is wrong then you've very
much misunderstood for statements.
Finally, please take your tablets. You know you really need them.
John
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
What does this line of code mean? groovee@cyberdude.com - 2019-09-21 11:15 -0700
Re: What does this line of code mean? Jon Ribbens <jon+usenet@unequivocal.eu> - 2019-09-21 18:30 +0000
Re: What does this line of code mean? John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-22 11:25 +0100
Re: What does this line of code mean? Julio Di Egidio <julio@diegidio.name> - 2019-09-22 04:53 -0700
Re: What does this line of code mean? John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-22 15:40 +0100
Re: What does this line of code mean? "R.Wieser" <address@not.available> - 2019-09-22 19:01 +0200
Re: What does this line of code mean? John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-23 11:13 +0100
Re: What does this line of code mean? "R.Wieser" <address@not.available> - 2019-09-23 14:15 +0200
Re: What does this line of code mean? groovee@cyberdude.com - 2019-09-25 12:20 -0700
Re: What does this line of code mean? "R.Wieser" <address@not.available> - 2019-09-22 15:39 +0200
Re: What does this line of code mean? Julio Di Egidio <julio@diegidio.name> - 2019-09-22 06:57 -0700
Re: What does this line of code mean? "R.Wieser" <address@not.available> - 2019-09-22 18:49 +0200
csiph-web