3
0

arith-for.right 903 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. 0
  2. 1
  3. 2
  4. 0
  5. 1
  6. 2
  7. 0
  8. 1
  9. 2
  10. 0
  11. 2
  12. 4
  13. fx is a function
  14. fx ()
  15. {
  16. i=0;
  17. for ((1; i < 3; i++ ))
  18. do
  19. echo $i;
  20. done;
  21. for ((i=0; 1; i++ ))
  22. do
  23. if (( i >= 3 )); then
  24. break;
  25. fi;
  26. echo $i;
  27. done;
  28. for ((i=0; i<3; 1))
  29. do
  30. echo $i;
  31. (( i++ ));
  32. done;
  33. i=0;
  34. for ((1; 1; 1))
  35. do
  36. if (( i > 2 )); then
  37. break;
  38. fi;
  39. echo $i;
  40. (( i++ ));
  41. done;
  42. i=0;
  43. for ((1; 1; 1))
  44. do
  45. if (( i > 2 )); then
  46. break;
  47. fi;
  48. echo $i;
  49. (( i++ ));
  50. done
  51. }
  52. 0
  53. 1
  54. 2
  55. 0
  56. 1
  57. 2
  58. 0
  59. 1
  60. 2
  61. 0
  62. 1
  63. 2
  64. 0
  65. 1
  66. 2
  67. ./arith-for.tests: line 77: syntax error: arithmetic expression required
  68. ./arith-for.tests: line 77: syntax error: `(( i=0; "i < 3" ))'
  69. 2
  70. ./arith-for.tests: line 83: syntax error: `;' unexpected
  71. ./arith-for.tests: line 83: syntax error: `(( i=0; i < 3; i++; 7 ))'
  72. 2
  73. 20
  74. 20