WhileLoop2.js 579 B

1234567891011121314151617181920212223
  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 = 100;
  6. function f()
  7. {
  8. x--;
  9. return x;
  10. }
  11. for(var i = 0; i < 10; ++i)
  12. {
  13. var a = i;
  14. while(f() > 0 && a > 5)
  15. {
  16. WScript.Echo("f: " + x);
  17. --a;
  18. }
  19. }