From 99950633043a41157d3f6ad222a127b4876e41d2 Mon Sep 17 00:00:00 2001 From: kahsa Date: Wed, 20 Jul 2022 20:24:13 +0900 Subject: [PATCH] doc: add a `go fn() {}` example (#15134) --- doc/docs.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/docs.md b/doc/docs.md index 4c477679af..0b382b9f07 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -3601,6 +3601,11 @@ fn p(a f64, b f64) { // ordinary function without return value fn main() { go p(3, 4) // 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) } ```