Exercise 2. Write a loop that swaps adjacent elements of an array of integers. For example,
Array(1, 2, 3, 4, 5) becomes Array(2, 1, 4, 3, 5) .
Solution:
values. Use for /yield.
Solution:
Note: I realize you can not write java style for yield statement, like if ( i%2 ==0 ) yield s(i+1)