Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions codes/session-1/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package main

import "fmt"

/**
* Define constants
* Float, String and iota (incremental)
*/
const (
PI = 3.14
LANGUAGE = "Go"

A = iota
B = iota
C = iota
)

/**
* Define constants iota (incremental)
*/
const (
P = iota
Q = iota
R = iota
)

/**
* Define constants iota (incremental)
* Here, Y and Z does has type, so Go will assume Y and Z are of type iota from X
*/
const (
X = iota
Y
Z
)

func main() {

/**
* OUTPUT: 3.14
*/
fmt.Println(PI)

/**
* OUTPUT: Go
*/
fmt.Println(LANGUAGE)

/**
* OUTPUT: 2 3 4
*/
fmt.Println(A, B, C)

/**
* OUTPUT: 0 1 2
*/
fmt.Println(P, Q, R)

/**
* OUTPUT: 0 1 2
*/
fmt.Println(X, Y, Z)
}