adspace


Tell us the difference between the while and for loop. Provide a .net syntax for both loops?

Answer Posted / Sunil Dutt

"While loop is a control structure that repeats a block of code as long as a specified condition is true, whereas a For loop is used to repeat a block of code a specific number of times. Syntax: While (condition) {n// Code to be executed n}nSyntax for For loop in C#: for(initialization; condition; increment/decrement) {n// Code to be executedn}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write the .net syntax for 'while loop'?

1141