Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // controles ifinit ifinit.go
- package main
- import (
- "fmt"
- "math/rand"
- "time"
- )
- func numeroAleatorio() int {
- s := rand.NewSource(time.Now().UnixNano())
- r := rand.New(s)
- return r.Intn(10)
- }
- func main() {
- if i := numeroAleatorio(); i > 5 { // tb suportado no switch
- fmt.Println("Ganhou!!!")
- } else {
- fmt.Println("Perdeu!")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement