Main Content:

BRANCHING AND LOOPING







BRANCHING AND LOOPING
« on: November 28, 2006, 09:42:53 PM »




Jobs in Wipro Infotech & Other Top Companies

- Click here to Register in Shine.com Today!

------------------------------------------------------

- FRESHERS -

Receive SMS Alerts on Walkins Held in Your City

SMS "Your City Name" to (0) 98410 80502



FOR MORE & MORE TECHNICAL INTERVIEW QUESTIONS …, Join Our Group now
http://in.groups.yahoo.com/group/knowledge-base/join/



Introduction

Unless you already understand the basics of “branching and looping” you should read The previous tutorial Controlling Program Flow in Plain English.

You have arrived at the point where programming becomes more challenging and if you have a programmers mind" far more interesting, so enjoy.

This is the stage where you have to start thinking, how can I code a particular aspect of my project.

This is the point where you start to develop your personel style.

Up to this tutorial your programs have been sequential or linear statements being executed one after the other. Now you are going to be introduced to constructs that alter that linear progression.

The new functions that are in this tutorial allow either branching or looping.

You will note that a pair braces { } are used with these constructs.

The { denotes the start of the first statement within the construct.
The } denotes the end of the last statement in the construct.

Tip: Take particular note of how braces { } are used.

Tip: Note where ; is NOT used in these constructs.

Tip: As you read my tutorials, books, course material etc., copy a few samples of each construct showing the use of braces and where ; is used or not used, for future reference. Pay particular note of the if ( ) ... else construct, and where constructs are nested. That it where a construct is placed within the braces of another construct. You can have several layers of nesting. A nested example is given later on this page.

Top of Page

 
Branching

Branching statements allow different sections of code to be executed, or not executed depending on some condition being either true or false.
The following constructs contain branching.

From the previous tutorial, “Do you require sugar” is an example

.

if, if ... else, while, do, switch, and for constructs.

All these construct contain a test. Think of test as a question. Example “Is the number less than 3”

All tests contain a comparison / conditional operator such as equal to, less than, or greater than. These comparison or conditional operators are listed below.

Top of Page

 
Looping

Looping constructs are used to repeat a section of code a number of times, depending on some condition being either true or false.

To take the previous lesson a little further, if somebody wanted 3 teaspoon full of sugar the you could repeat adding 1 spoonful of sugar 3 times.

Iteration is the correct term to use for this looping process

The looping constructs are while, do, for constructs.

Again these contructs contain a test and a a comparison / conditional operator



MNC Jobs in Chennai, Bangalore & Hyderabad

- Click here to Register in Shine.com Today!






BE THE FIRST ONE TO APPLY TO FRESH IT JOBS AS SOON AS IT COMES……JOIN OUR GROUP NOW
http://in.groups.yahoo.com/group/knowledge-base/join/


CareerEnclave.Com ~ We Shape Your Career ~
Keywords
Keywords : Job, job, Jobs, jobs, Career, career, Careers, careers, Employ, employ, Employment, employment, Recruit, recruit, Recruitment, recruitment,recruitment solution, Recruitment Solution, jobsassist, jobassist, jobs-assist, http://www.careerenclave.com/, Naukri, naukri, Naukari, naukari, nokri,india, indian, placement, outsource jobs, Resume Writing, Resume Development, Career Services, Resume blaster, resume flash, resume india, resume, bangalore, mumbai, delhi, hyderabad, chennai, computer, software, hardware, fresher, freshers, experienced, IT, project, projects, vyom, vyomworld, opening, test, papers, counsultancy, address, addresses, infosys, tcs, MBT, wipro, satyam, ibm, microsoft, bosch, siemen, reliance



Jump to: