Golang Notes

GO LANG SPEC + OPERATOR INTEGER OPERAND GOLANG PLAYGO+ROUND EFFECTIVE GO https://golang.org/ref/spec

go fmt formating

package main
import (
       "fmt"
)

func main() {
    n, err := fmt.Println("Hello, playground", 42, true)
        fmt.Println(n)
        fmt.Println(err)
}

== Output ===
Hello, playground 42 true
26
<nil>


DECLARE AND ASSIGN

x :   <--- DECLARE
= 42  <--- ASSIGN

x := 42 DECLARE AND ASSIGN

##############################################

Short declation doesnt work outside curly only function inside body
var work outside curly global

var z int = integer and value of zero / false / nil

##############################################

var y = 42
var z = "any"


func main() {
fmt.Println(y)
fmt.Printf("%T\n",y)
fmt.Println(z)
fmt.Printf("%T\n",z)

=

42
int
any
string

###################################################

fmt with example

fmt.Println(y) -> 42
fmt.Printf("%b\n",y)  -> binary and so on check doc

add all fmt.Printf("%#x\t%b\t%x", y, y, y)  t is tab printing


###################################################
convertion or casting

var a int
type hotdog int
var b hotdog

convert a= int(b)

https://play.golang.org/p/jwqDWUpyvid
https://play.golang.org/p/4tFoLHyhCyz
https://play.golang.org/p/jqf-_SdWewl
https://play.golang.org/p/HmgBMQn0W59
https://play.golang.org/p/Ar29qvlangV

#INT FLOAT
https://play.golang.org/p/qpbBp4SvZRM
#INT8
https://play.golang.org/p/k4yy4KlkvSw
dont work https://play.golang.org/p/9m2Eb8PGfI9

# RUNTIME PACKAGE show OS and Architecture
https://play.golang.org/p/I8YCQqnicvv

#uint8 is byte this is convertion or slice of byte ascii coding scheme
https://play.golang.org/p/8LNPPV_XelN
https://play.golang.org/p/XpLOO-EmgEG <-hexa

#constant like variables
https://play.golang.org/p/mtGfBxMrlth

#iota increment
https://play.golang.org/p/vZ-TlPHDmVK

#bit shifting
https://play.golang.org/p/twouwaVyQC0

#kb to mb to gb
https://play.golang.org/p/Xbem47fTmD8

#iota donot use first line which is zeo
https://play.golang.org/p/6EZkT90Hytw


#variables decmal hexa bit shifting
https://play.golang.org/p/BDsMikH-nOD


#raw string literal
https://play.golang.org/p/AlVFunh7JaL

#iota add +1
https://play.golang.org/p/QWqnXcElqEV


rune is int32
byte is uint8


video 48 digeridoo

#for loop
package main
import "fmt"
func main(){
    for init; condition;post {
    fmt.Println("Hello, playground")

}
}


for i := 0; i <= 100; i++
//++ is operator increment by1
fmt.Println(i)



#nesting loop outerandinsideloop
https://play.golang.org/p/W-MgdztTLII

package main

import (
    "fmt"
)

func main() {
    for i := 0; i <= 10; i++ {
        fmt.Printf("The outer loop: %d\n", i)
        for j := 0; j < 3; j++ {
            fmt.Printf("\t\t The inner loop: %d\n", j)

        }
    }
}


### loop
https://play.golang.org/p/jmcuG6lb7eL

x:=1
for x < 10 {
    fmt.Println(x)
    x++
}
fmt.Println("done.")
}

### print 1 to 10000
https://play.golang.org/p/xN47SXb2qOR
### print 65 to 90
https://play.golang.org/p/u-53lQqEsjP
### print 65 to 90 unicode
https://play.golang.org/p/rnCBaIUvGn3
###print every letter 3 times
https://play.golang.org/p/qKmGpn3pHxc


##ARRAY
https://play.golang.org/p/wqyYCgfA0Hg
https://play.golang.org/p/MGz-TCaHkTA

## SLICES
https://play.golang.org/p/u6awtNYLPsu
https://play.golang.org/p/T2uplc8I2JL

## ACCESSING INDEX POSITION VARIABLES ON SLICES
https://play.golang.org/p/rPExKxSW7mF


## SLICING A SLICE
https://play.golang.org/p/OqsjB2b1-hZ

## appennding slices
https://play.golang.org/p/xzGMDESHMce
https://play.golang.org/p/4Oqr5A2AcK0
https://play.golang.org/p/JYYrDxlVgdr
### DELETE FROM SLICE
https://play.golang.org/p/cxpQ_0roj-J
## MAKE SLICE
https://play.golang.org/p/pZwnOftrcLm
https://play.golang.org/p/9FsHGXcFl89

## Maps mapping
https://play.golang.org/p/SgVtSFfidJx

## MAP ADD ELEMENT RAnge
https://play.golang.org/p/bXlQAdjdY4g
MAP SHOWING RECORS
https://play.golang.org/p/R5gUTw4vM9X
https://play.golang.org/p/YgvZMAxABMp added additional record
https://play.golang.org/p/cYnm0x4ahqQ deleted a record

https://play.golang.org/p/Us7n8pC8Nm7


## ARRAY I WANT TO PRINT ONLY 5 CHAR
https://play.golang.org/p/32k9Q1jWdI1

STRUCT complex data  composite data type aggregate data type
https://play.golang.org/p/8yaATcxQ6_y
https://play.golang.org/p/QKGqGpMJ4Pw

embed one type to another type
https://play.golang.org/p/QI1q94V78vn

https://play.golang.org/p/dE-ixErDWC1

##range own type with underlying type
 https://play.golang.org/p/qa8CrVEphtD

## different data structure
https://play.golang.org/p/UMGFR-Pri1J

https://play.golang.org/p/UMGFR-Pri1J

#stuct
https://play.golang.org/p/-TEgungwX8P

Comments

Popular posts from this blog

Black screen after logging in on Windows 2012 R2 using domain credentials on remote desktop connection

Water Wonder Resort

Client denied by server configuration error