• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

NESTED LOOPS

As you’ve seen up to this point, loops provide a great way of automating a set of scripting tasks. However, loops can accomplish more than a straight, linear, repetitive execution of a set of actions. A nested loop, or a loop placed inside another loop, can be useful for creating a looping sequence that executes a set of actions, changes a bit, executes those same actions again, changes a bit, and so on.The following is an example of a nested loop:

					var i = 0;
					while (++i <= 10) {
					var j = 0;
					while (++j <= 10) {
					// perform these actions
					}
					}
				


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint