मराठी
तामिळनाडू बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान इयत्ता १२

Differentiate For each and While loop. - Computer Applications

Advertisements
Advertisements

प्रश्न

Differentiate For each and While loop.

थोडक्यात उत्तर

उत्तर

  While loop Foreach loop
Working principle The while statement will execute a block of code If and as Song as a test ex­pression, is true. The foreach statement is used to loop through arrays.
Working principle If the test expression is true then the code block will be executed. After the code has executed the test expression will again be evaluated and the loop will continue until the test expression is found to be false. For each pass, the value of the current array element is assigned to $value and the array pointer is moved by one and in the next pass, the next element will be processed.
Syntax
while(condition)
{
code to be executed;
}
for each ($array as $value)
{
code to be executed;
}
shaalaa.com
Looping Structure
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 7: Looping Structure - Evaluation - PART – III [पृष्ठ ११८]

APPEARS IN

सामाचीर कलवी Computer Applications [English] Class 12 TN Board
पाठ 7 Looping Structure
Evaluation - PART – III | Q 3. | पृष्ठ ११८
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×