Free Assignments via E-mail

Enter your email address:

Subscribe the blog by your Email ID for the SMU MBA assignments updates.

Saturday, February 19, 2011

It is the answer of this question – “Explain with an example the for loop in Java Script? What are the other types of looping?” The question is prepared for SMU MI0032 MBA assignment. I have already shared a solved question of SMU MI0032 (Java and Web Design) assignment - Various Rules for Naming a Variable in Java.

A loop statement checks to see if some condition is true, say our condition is “Are there any invitations left?” and if that condition is true it will execute a chunk of code. Our code is this example would be stuff, lick, and seal the envelope. After the code is executed the condition is checked again, if it is true then the process begins again, if it is false, then the loop code stops execution and the script continues along.

Javascript for Loop:

The Javascript for loop resembles the for loop you might have seen in many other programming languages. It is used when you need to do a set of operations many times, with an increment of some kind after each run through the block of code.

Javascript for Loop Explained:

There are four important aspects of a Javascript for Loop:

1. The counter variable is something that is created and usually used only in the for loop to count how many times the for loop has looped.
2. The conditional statement that decides whether the for loop continues executing or not. This check usually includes the counter variable in some way.
3. The counter variable is incremented after every loop in the increment section of the for loop.
4. The code that is executed for each loop through the for loop.

This may seem strange, but 1-3 all occur on the same line of code. This is because the for loop is such a standardized programming practice that the designers felt they might as well save some space and clutter when creating the for loop.

There is a solve question of – “Explain the various rules for naming a variable in Java? Give one example for each.” You can take it for Sikkim Manipal University (SMU) MBA Assignment MI0032. You can see some SMU MI0032 assignments also like Ecommerce Opportunities for Industries and QR System of Wal-Mart and Functions of Supply Chain Management.

Java allocates memory to each variable and constant you use in your program. As in algebra, the values of variables may change in a program, but the values of constants, as the name suggests, do not change. You must assign unique names to variables and constants. Variables names are used in a program in much the same way as they are in ordinary Algebra.

Each variable used in a program must be declared. That is to say, the program must contain a statement specifying precisely what kind of information (data type) the variable will contain. This applies to every variable used in the program, regardless of the type.

Naming Variables:

A program refers to a variable using its name. Certain rules and conventions govern the naming of variables. You must adhere to rules. Conventions help improve the readability of the program, but following them is not mandatory.

Rules for Naming Variables in Java:

A variable name:

Must not be a keyword in Java.
Must not begin with a digit.
Must not contain embedded spaces.
Can contain characters from various alphabets, like Japanese, Greek and Cyrillic.

When you learned algebraic equations in school, you used x and y to represent values in equations. Unlike pi which has a constant value of 3.14, the values of x and y not constant in equations. Java provides constants and variables to store data in programs. You can elaborate it also more by yourself.

New MBA Assignments

Opinions on MBA Assignments