DoLoop.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 x = 6;
  6. var giraffe = 8;
  7. var zebra = x + giraffe;
  8. function f(t) {
  9. return t + t;
  10. }
  11. var cat = f(zebra);
  12. rat = cat * 2;
  13. do {
  14. rat = rat - 3;
  15. cat = cat + 4;
  16. }
  17. while (rat > 4);
  18. var dragon = rat / 2;
  19. WScript.Echo(x)
  20. WScript.Echo(giraffe)
  21. WScript.Echo(zebra)
  22. WScript.Echo(cat)
  23. WScript.Echo(rat)
  24. WScript.Echo(dragon);
  25. do
  26. {
  27. WScript.Echo("Should print once - 0");
  28. }
  29. while(0);
  30. do
  31. {
  32. WScript.Echo("Should print once - false");
  33. }
  34. while(false);
  35. a: do
  36. {
  37. WScript.Echo("Should print once - label");
  38. do
  39. {
  40. break a;
  41. }while(false);
  42. WScript.Echo("Should not print");
  43. }
  44. while(false);