1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

doc: add a go fn() {} example (#15134)

This commit is contained in:
kahsa 2022-07-20 20:24:13 +09:00 committed by GitHub
parent f27c0387ad
commit 9995063304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3601,6 +3601,11 @@ fn p(a f64, b f64) { // ordinary function without return value
fn main() { fn main() {
go p(3, 4) go p(3, 4)
// p will be run in parallel thread // p will be run in parallel thread
// It can also be written as follows
// go fn (a f64, b f64) {
// c := math.sqrt(a * a + b * b)
// println(c)
// }(3, 4)
} }
``` ```