Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
425 B

  1. local arr=["one","two","three"]
  2. ::print("FOREACH\n");
  3. foreach(i,val in arr)
  4. {
  5. ::print("index ["+i+"]="+val+"\n");
  6. }
  7. ::print("FOR\n");
  8. for(local i=0;i<arr.len();i+=1)
  9. {
  10. ::print("index ["+i+"]="+arr[i]+"\n");
  11. }
  12. ::print("WHILE\n");
  13. local i=0;
  14. while(i<arr.len())
  15. {
  16. ::print("index ["+i+"]="+arr[i]+"\n");
  17. i+=1;
  18. }
  19. ::print("DO WHILE\n");
  20. local i=0;
  21. do
  22. {
  23. ::print("index ["+i+"]="+arr[i]+"\n");
  24. i+=1;
  25. }while(i<arr.len());