File tree Expand file tree Collapse file tree 4 files changed +33
-5
lines changed Expand file tree Collapse file tree 4 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ package main
3
3
import (
4
4
"fmt"
5
5
"github.com/callicoder/golang-tutorials/07-packages/numbers"
6
- "github.com/callicoder/golang-tutorials/07-packages/strings"
6
+ "github.com/callicoder/golang-tutorials/07-packages/strings"
7
7
"github.com/callicoder/golang-tutorials/07-packages/strings/greetings" // Importing a nested package
8
8
str "strings" // Package Alias
9
9
)
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "fmt"
5
+ "time"
6
+ "math"
7
+ "math/rand"
8
+ )
9
+
10
+ func main () {
11
+ // Finding the Max of two numbers
12
+ fmt .Println (math .Max (73.15 , 92.46 ))
13
+
14
+ // Calculate the square root of a number
15
+ fmt .Println (math .Sqrt (225 ))
16
+
17
+ // Printing the value of `𝜋`
18
+ fmt .Println (math .Pi )
19
+
20
+ // Epoch time in milliseconds
21
+ epoch := time .Now ().Unix ()
22
+ fmt .Println (epoch )
23
+
24
+ // Generating a random integer between 0 to 100
25
+ rand .Seed (epoch )
26
+ fmt .Println (rand .Intn (100 ))
27
+ }
Original file line number Diff line number Diff line change @@ -9,6 +9,5 @@ func IsPrime(num int) bool {
9
9
return false
10
10
}
11
11
}
12
-
13
12
return num > 1
14
13
}
Original file line number Diff line number Diff line change 2
2
package greetings
3
3
4
4
// Exported
5
- const WelcomeText = "Hello, World to Golang"
6
- const MorningText = "Good Morning"
7
- const EveningText = "Good Evening"
5
+ const (
6
+ WelcomeText = "Hello, World to Golang"
7
+ MorningText = "Good Morning"
8
+ EveningText = "Good Evening"
9
+ )
8
10
9
11
// Not exported (only visible inside the `greetings` package)
10
12
var loremIpsumText = `Lorem ipsum dolor sit amet, consectetur adipiscing elit,
You can’t perform that action at this time.
0 commit comments