Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // controles for for.go
- package main
- import (
- "fmt"
- "time"
- )
- func main() {
- i := 1
- for i <= 10 { // não tem while em Go
- fmt.Println(i)
- i++
- }
- for i := 0; i <= 20; i += 2 {
- fmt.Printf("%d", i)
- }
- fmt.Println("\nMisturando... ")
- for i := 1; i <= 10; i++ {
- if i%2 == 0 {
- fmt.Print("Par ")
- } else {
- fmt.Print("Impar ")
- }
- }
- i = 1
- for {
- // loaço infinito
- fmt.Println("Para sempre... ")
- i++
- time.Sleep(time.Second)
- if i == 5 {
- break
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement