resource arguments() var str : string[64] var status, n : int write("There are", numargs(), "arguments") fa i := 0 to numargs()+1 -> status := getarg(i, n) if status = EOF -> writes("no ", i, "-th argument\n") [] status = 0 -> getarg(i, str) write("could not process argument", i, "as an integer -- as a string, it is", str) [] else -> write("argument", i, "is", n) fi af writes("The even numbered arguments are") fa i := 0 to numargs() by 2 -> getarg(i, str); writes(" ", str) af write() writes("And the odd numbered arguments in reverse order are") fa i := 2*int((numargs()+1)/2.0)-1 downto 1 by -2 -> getarg(i, str); writes(" ", str) af write() end arguments /* ............... Example compile and run(s) % sr -o args args.sr % ./args There are 0 arguments could not process argument 0 as an integer -- as a string, it is ./args no 1-th argument The even numbered arguments are ./args And the odd numbered arguments in reverse order are % ./args 1 There are 1 arguments could not process argument 0 as an integer -- as a string, it is ./args argument 1 is 1 no 2-th argument The even numbered arguments are ./args And the odd numbered arguments in reverse order are 1 % ./args 1 b There are 2 arguments could not process argument 0 as an integer -- as a string, it is ./args argument 1 is 1 could not process argument 2 as an integer -- as a string, it is b no 3-th argument The even numbered arguments are ./args b And the odd numbered arguments in reverse order are 1 % ./args 1 2 c 3 e There are 5 arguments could not process argument 0 as an integer -- as a string, it is ./args argument 1 is 1 argument 2 is 2 could not process argument 3 as an integer -- as a string, it is c argument 4 is 3 could not process argument 5 as an integer -- as a string, it is e no 6-th argument The even numbered arguments are ./args 2 3 And the odd numbered arguments in reverse order are e c 1 */