ZenScript main repository
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

moreHellos.zs 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. println("Hello world!");
  2. println(1 as string);
  3. var test = "test";
  4. println(test);
  5. test = "testMore";
  6. println(test);
  7. test = 13;
  8. println(test);
  9. val test2 = 14;
  10. println(test2);
  11. if true
  12. println("ifTest");
  13. else
  14. println("elseTest");
  15. if false
  16. println("testIf");
  17. else
  18. println("testElse");
  19. if (true) {
  20. while :testLable true {
  21. println("trueee");
  22. if true
  23. break testLable;
  24. else
  25. println("nobreak");
  26. }
  27. do {
  28. println("tru");
  29. if(false){
  30. println("brea");
  31. continue;
  32. }
  33. else{
  34. println("");
  35. break;
  36. }
  37. } while true;
  38. }
  39. var testArray = ["1", "2", "3"];
  40. for item in testArray {
  41. println("test");
  42. println(item);
  43. }
  44. println("");
  45. var test3 = [1, 2, 3];
  46. for item in test3 {
  47. println(item);
  48. }
  49. for i, item in ["5", "ttt"] {
  50. println(item + i);
  51. }
  52. for i, item in [1, 5, 7] {
  53. println(item + (i as int));
  54. }
  55. for myI in 10 .. 20 {
  56. println(myI);
  57. }
  58. var lateInit as string;
  59. lateInit = "initialized later";
  60. println(lateInit);
  61. /*
  62. catch e as string {
  63. println("noLuv");
  64. }
  65. */