Skip to content

Commit 19ff441

Browse files
committed
.
1 parent 4189207 commit 19ff441

File tree

6 files changed

+62
-0
lines changed

6 files changed

+62
-0
lines changed

data-types/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module data-types
2+
3+
go 1.17

data-types/main.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package main
2+
3+
func main() {
4+
// Data Types
5+
// Boolean types
6+
/*
7+
They are boolean types and consists of the two predefined constants: (a) true (b) false
8+
*/
9+
// Numberic types
10+
/*
11+
They are again arithmetic types and they represents a) integer types or b) floating point values throughout the program.
12+
*/
13+
// String types
14+
/*
15+
A string type represents the set of string values. Its value is a sequence of bytes. Strings are immutable types that is once created, it is not possible to change the contents of a string. The predeclared string type is string.
16+
*/
17+
// Derived types
18+
/*
19+
They include (a) Pointer types, (b) Array types, (c) Structure types, (d) Union types and (e) Function types f) Slice types g) Interface types h) Map types i) Channel Types
20+
*/
21+
22+
}

functions/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module functions
2+
3+
go 1.17

functions/main.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package main
2+
3+
import "fmt"
4+
5+
func main() {
6+
cal := add(1, 2)
7+
fmt.Println(cal)
8+
addVoid(1, 2)
9+
10+
}
11+
12+
func add(num1 int, num2 int) int {
13+
return num1 + num2
14+
}
15+
16+
func addVoid(num1 int, num2 int) {
17+
fmt.Println(num1 + num2)
18+
}

variables/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module variables
2+
3+
go 1.17

variables/main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package main
2+
3+
import "fmt"
4+
5+
func main() {
6+
// var variable_list optional_data_type;
7+
var x float64 = 20.4
8+
y := 42.9
9+
fmt.Println(x)
10+
fmt.Println(y)
11+
fmt.Printf("x is type of %T \n", x)
12+
fmt.Printf("y is type of %T \n ", y)
13+
}

0 commit comments

Comments
 (0)