DoLoop3.js 954 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. var i = 0;
  6. function f()
  7. {
  8. WScript.Echo("condition, i = " + i);
  9. return i < 10;
  10. }
  11. WScript.Echo("--- test 1 ---");
  12. do
  13. {
  14. ++i;
  15. if(i > 5)
  16. continue;
  17. WScript.Echo("after continue: " + i++);
  18. } while(f());
  19. i = 0;
  20. WScript.Echo("--- test 2 ---");
  21. do
  22. {
  23. switch(i++)
  24. {
  25. case 0:
  26. case 1:
  27. case 2:
  28. case 3:
  29. case 4:
  30. case 5:
  31. continue;
  32. default:
  33. WScript.Echo("default");
  34. case 9:
  35. break;
  36. }
  37. } while(f());
  38. WScript.Echo("done");