Another approach is to use Step in your repeat loop. See this:
on test
repeat with a = 1 to 10 step 2
put return & a*3 after msg
put return & sqrt(a+1) after msg
end repeat
end test
For odd numbers a*3 will be put, and for even numbers the square root
of the number will be put. Doing it that way involves no if
statements, and no function calls.