tstmtlists.nim 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. discard """
  2. output: '''
  3. 2
  4. 2
  5. 2
  6. 2
  7. 2
  8. 2
  9. 2
  10. 2
  11. 2
  12. 2
  13. hello
  14. 1
  15. hello
  16. 2
  17. hello
  18. 3
  19. hello
  20. 4
  21. hello
  22. 5
  23. hello
  24. 6
  25. hello
  26. 7
  27. hello
  28. 8
  29. hello
  30. 9
  31. hello
  32. 10
  33. hello
  34. 1
  35. hello
  36. 2
  37. hello
  38. 3
  39. hello
  40. 4
  41. hello
  42. 5
  43. hello
  44. 6
  45. hello
  46. 7
  47. hello
  48. 8
  49. hello
  50. 9
  51. hello
  52. 10
  53. lucky
  54. lucky
  55. '''
  56. """
  57. block: (
  58. discard;
  59. echo 1 + 1;
  60. )
  61. block: (
  62. discard; #Haha
  63. #haha
  64. echo 1 + 1;
  65. )
  66. block: (
  67. discard;
  68. #Hmm
  69. echo 1 +
  70. 1;
  71. )
  72. block: (
  73. discard
  74. echo "2"
  75. )
  76. block: (
  77. discard;
  78. echo 1 +
  79. 1
  80. )
  81. block: (
  82. discard
  83. echo 1 +
  84. 1
  85. )
  86. block: (
  87. discard;
  88. discard
  89. )
  90. block: (
  91. discard
  92. echo 1 + 1;
  93. )
  94. block: (
  95. discard
  96. echo 1 + 1;
  97. )
  98. block: (
  99. discard
  100. echo 1 +
  101. 1;
  102. )
  103. block: (
  104. discard;
  105. )
  106. block: ( discard; echo 1 + #heh
  107. 1;
  108. )
  109. for i in 1..10:
  110. echo "hello"
  111. echo i
  112. for i in 1..10: (
  113. echo "hello";
  114. echo i;
  115. )
  116. proc square(inSeq: seq[float]): seq[float] = (
  117. result = newSeq[float](len(inSeq));
  118. for i, v in inSeq: (
  119. result[i] = v * v;
  120. )
  121. )
  122. proc square2(inSeq: seq[float]): seq[float] =
  123. result = newSeq[float](len(inSeq));
  124. for i, v in inSeq: (
  125. result[i] = v * v;
  126. )
  127. proc cstringCheck(tracked: int; n: int) =
  128. if true == false and (let a = high(int); let b = high(int);
  129. a.int8 == 8 and a.int8 notin {3..9}):
  130. echo(tracked, n)
  131. template dim: int =
  132. (if int.high == 0:
  133. int.high
  134. else:
  135. int.high)
  136. template dim2: int =
  137. (if int.high == 0:
  138. int.high
  139. else:
  140. int.high)
  141. template dim3: int =
  142. (
  143. if int.high == 0:
  144. int.high
  145. else:
  146. int.high)
  147. # lenient indentation:
  148. echo (if 0 == 1:
  149. "0 == 1"
  150. else:
  151. "lucky")
  152. # bug #16426
  153. echo (when 0 == 1:
  154. "0 == 1"
  155. else:
  156. "lucky")