You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

33 lines
483 B

package main
import (
"os"
"github.com/01-edu/z01"
)
func printStr(str string) {
arrayStr := []rune(str)
for i := 0; i < len(arrayStr); i++ {
z01.PrintRune(arrayStr[i])
}
z01.PrintRune('\n')
}
func isEven(nbr int) bool {
return nbr%2 == 0
}
func main() {
EvenMsg := "I have an even number of arguments"
OddMsg := "I have an odd number of arguments"
lenOfArg := len(os.Args) - 1
if isEven(lenOfArg) == true {
printStr(EvenMsg)
} else {
printStr(OddMsg)
}
}