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.
47 lines
618 B
47 lines
618 B
6 years ago
|
## Boolean
|
||
6 years ago
|
|
||
6 years ago
|
### Instructions
|
||
6 years ago
|
|
||
|
Create a `.go` file and copy the code below into our file
|
||
|
|
||
|
- The main task is to return a working program.
|
||
|
|
||
|
```go
|
||
|
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) boolean {
|
||
|
if even(nbr) == 1 {
|
||
|
return yes
|
||
|
} else {
|
||
|
return no
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
if isEven(lengthOfArg) == 1 {
|
||
|
printStr(EvenMsg)
|
||
|
} else {
|
||
|
printStr(OddMsg)
|
||
|
}
|
||
|
}
|
||
|
```
|
||
|
|
||
6 years ago
|
### Expected output
|
||
6 years ago
|
|
||
|
```console
|
||
6 years ago
|
I have an even number of arguments
|
||
|
```
|
||
6 years ago
|
|
||
6 years ago
|
### Or
|
||
6 years ago
|
|
||
|
```console
|
||
6 years ago
|
I have an odd number of arguments
|
||
6 years ago
|
```
|