Loop

From wikieduonline
Revision as of 06:54, 3 March 2021 by Welcome (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Infinite loop

go

package main
import "fmt"

func main() {
  sum := 0
  for {
    sum++ 
    fmt.Println(sum)
  }
}

Go do not support parallel for-loops , deprecated Sun's Fortress was support it. But they are easy to implement using goroutines.[1]


Bash

#!/bin/bash
while true; do
 ((var++))
echo $var
done


Related terms

See also

  • http://www.golangpatterns.info/concurrency/parallel-for-loop
  • Advertising: