This is a discussion on "Help with 'for' loop" within the JavaScript Forum section. This forum, and the thread "Help with 'for' loop are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Help with 'for' loop
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Can someone please explain the 'for' loop for me? i get so confused, here is an example for loop i found. What i don't understand is how they get the bits in bold:
I know to some of you this may be easy, but I have learning difficulties, could someone explain it in very very easy steps please. Last edited by karinne; Jun 5th, 2007 at 12:42. Reason: Please use [php]...[/php] tags when displaying PHP code. |
|
|
|
|||
|
Re: Help with 'for' loop
What is with the edit lol, that is not PHP, it's a JavaScript loop
|
|
||||
|
Re: Help with 'for' loop
to complement Ryan's answer, the official definition of a Javascript for loop is...
for( INITIALIZE, CONDITION, INCREMENT ){ // ... do stuff } INITIALIZE: a statement executed before the loop starts This is usually used to declare a counter to be used in the loop CONDITION: an expression that evaluates to either true or false This is tested at the end of every cycle, false indicates "stop looping"... INCREMENT: a statement to be executed at the end of every cycle. This is usually used to increment the counter (eg.: add 1) Now tell me, what the hell did you mean by this? What i don't understand is how they get the bits in bold If you mean you saw the code somewhere and some words (such as for) were in bold, this is called syntax highlighting. It makes it easier for programmers to read the code and identify special commands. 'How they make it bold' would be too much for you to understand at this stage...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
||||
|
Re: Help with 'for' loop
Nice explanation Spinal
|
![]() |
| Tags |
| help, loops, with |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Do a while loop once? | Jack Franklin | PHP Forum | 2 | Feb 15th, 2008 11:07 |
| The Loop (Again) | Blake121 | Free Web Site Critique | 16 | Sep 7th, 2007 13:57 |
| The Loop V2 | Blake121 | Free Web Site Critique | 8 | May 15th, 2007 09:37 |
| The Loop | Blake121 | Free Web Site Critique | 5 | May 1st, 2007 14:25 |
| Loop??? | tazek0 | Classic ASP | 0 | Jan 27th, 2006 07:38 |