Sunday, 17 January 2016

Questions

1. What is difference between For loop and While loop ?
    
The while loop is usually used when you need to repeat something until a given condition is true:

inputInvalid = true;
while(inputInvalid)
{
    //ask user for input
    invalidInput = checkValidInput();
}


On the other hand, the for loop is usually used when you need to iterate a given number of times:

for(var i = 0; i < 100; i++)
{
    ...//do something for a 100 times.
}

No comments:

Post a Comment

MobileAutomation - Handle Pop-ups, Alerts and Prompts in Automate and App Automate Tests

This article shows you how to handle user permission pop-ups, alerts, and prompts in your automated tests on BrowserStack. Introductio...