mirror of https://github.com/01-edu/public.git
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.
Pav01Founders
3e4722dffb
|
3 years ago | |
---|---|---|
.. | ||
README.md | 3 years ago |
README.md
boolean
Instructions
Create a new directory called boolean
.
-
The code below must be copied into a file called
main.go
inside of theboolean
directory. -
The necessary changes must be applied for the program to work.
Code to be copied
func printStr(s string) {
for _, r := range s {
z01.PrintRune(r)
}
z01.PrintRune('\n')
}
func isEven(nbr int) boolean {
if even(nbr) == 1 {
return yes
} else {
return no
}
}
func main() {
if isEven(lengthOfArg) == 1 {
printStr(EvenMsg)
} else {
printStr(OddMsg)
}
}
Usage
$ go run . "not" "odd"
I have an even number of arguments
$ go run . "not even"
I have an odd number of arguments