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.

hace 3 semanas
123456789101112131415161718192021222324252627
  1. package main
  2. import "fmt"
  3. func ifelse() {
  4. if 7%2 == 0 {
  5. fmt.Println("7 is even")
  6. } else {
  7. fmt.Println("7 is odd")
  8. }
  9. if 8%4 == 0 {
  10. fmt.Println("8 is divisible by 4")
  11. }
  12. if 8%2 == 0 || 7%2 == 0 {
  13. fmt.Println("either 8 or 7 is even")
  14. }
  15. if num := 9; num < 0 {
  16. fmt.Println(num, "is negative")
  17. } else if num < 10 {
  18. fmt.Println(num, "has one digit")
  19. } else {
  20. fmt.Println(num, "has multiple digits")
  21. }
  22. }