Skip to content

Instantly share code, notes, and snippets.

View pkbhowmick's full-sized avatar
🎯
Focusing

Pulak Kanti Bhowmick pkbhowmick

🎯
Focusing
View GitHub Profile
@pkbhowmick
pkbhowmick / slice.go
Created January 10, 2023 17:22
Slice in Golang
package main
import (
"fmt"
)
func main() {
nums := []int{1, 2, 3, 4, 5, 6, 7, 8}
printSlice(nums)
package main
import (
"fmt"
)
type Number interface {
~int | ~int8 | ~int16 | ~int32 | ~int64
}
package main
import (
"fmt"
"sort"
)
type Person struct {
name string
weight float64
package main
import "fmt"
var res int
func main() {
res = -1
ch := make(chan bool)
go divide(ch, 10, 0)
package main
import (
"fmt"
"sync"
)
var wg sync.WaitGroup
func main() {
@pkbhowmick
pkbhowmick / interface_example.go
Created October 31, 2021 06:49
An example of interface in Golang
// A simple example of interface in Golang:
package main
import (
"fmt"
"math"
)
type Shape interface {
@pkbhowmick
pkbhowmick / buffered_channel.go
Created October 31, 2021 04:54
An example of buffered channel in Golang
// In Go, there are mainly two types of channel.
// 1. Unbuffered channel
// 2. Buffered channel
// Buffered channel can work asyncronously
// Let's see an example of buffered channel
package main
import (