Are you looking for somthing like this?

https://go.dev/play/p/_nERkkLC94h

peter

On Tuesday, July 19, 2022 at 12:14:14 PM UTC-4 agra...@googlemail.com wrote:

> hi,
>
> for i=0;i<10;i++ { go func () { /* const c=i OR var v=i */
>  fmt.Println("f:beg i=",i) // here c or v instead 
> // action 
>  fmt.Println("f:end i=",i) // here c or v instead 
> }}
> when this routines get interrupted then beg-i and end-i differ
> now i want at the beginning of the routine a const copy `const c int = i`
> but its not allowed and `var v int = i` does not work, too.
>
> does an instance of a go-routine has no own stack-frame like a normal 
> function (c i.e) and therein local/private variables ? 
>
> thanks in advance
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/e38abe5a-01b2-44c5-a1ce-0bbf43652426n%40googlegroups.com.

Reply via email to