loops.go 429 B

123456789101112131415161718192021222324252627282930313233
  1. package main
  2. import (
  3. "fmt"
  4. )
  5. func main() {
  6. i := 0
  7. for i < 10 {
  8. fmt.Println("Incrementando i", i)
  9. i++
  10. //time.Sleep(time.Second)
  11. }
  12. fmt.Println(i)
  13. for j := 0; j < 10; j++ {
  14. fmt.Println("Incrementando j", j)
  15. //time.Sleep(time.Second)
  16. }
  17. nomes := [3]string{"João", "Fernando", "Alice"}
  18. for indice, nome := range nomes {
  19. fmt.Println(indice, nome)
  20. }
  21. for _, nome := range nomes {
  22. fmt.Println(nome)
  23. }
  24. }