Forem

Cover image for Concurrency trong Go: Tạo goroutine
handuy
handuy

Posted on

1

Concurrency trong Go: Tạo goroutine

Video hướng dẫn cách tạo goroutine với từ khóa go:

Tham khảo code được sử dụng trong bài:

package main

import (
    "fmt"
)

func printNumber() {
    for i := 0; i <= 100; i++ {
        fmt.Printf("%d ", i)
    }
}

func printChar() {
    for i := 'A'; i < 'A'+26; i++ {
        fmt.Printf("%c ", i)
    }
}

func main() {
    go printNumber()
    go printChar()
}

Enter fullscreen mode Exit fullscreen mode

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay