Control Flow

Control flow is defined by Wikipedia as “In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated.”

This is important in programming, without it code will not execute properly.

In week 10 of programming class we went over the DOM and demonstrated how the Document Object Model works within coding via what is called a “while” loop. While loops are fundamental in programming as they offer the ability to process data and and run loops with the data via arrays and strings.

Above is an example of the code used to demonstrate a while loop, the code starts with a function, then an array of cars (Honda, Toyota, Bmw, Volvo, Saab, Ford) then initiates i, then starts the While loop to iterate one word after another until all are shown.

You are able to see the document object model in work by way of the last bit of text before the final curly bracket. The “document.getElementById(‘DataTwo’).innerHTML = text;” is the code one would use to properly link script values back to the HTML and vise versa. That is exactly why the DOM is so important, without it there would be no communication.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s