Monday, 6 May 2019

Go Language: Importing multiple packages


You can import multiple package using import block.

import (
         "fmt"
         "math/rand"
)

HelloWorld.go
package main

import (
 "fmt"
 "math/rand"
)

func main() {
 fmt.Println("Random Number : ", rand.Intn(100000))
}

Sample Output
Random Number :  98081

You can even import packages like below.
import "fmt"
import "math"


Previous                                                 Next                                                 Home

No comments:

Post a Comment