on reverse (str) res = "" repeat with i = str.length down to 1 put str.char[i] after res end repeat return res end