Difference between revisions of "Loop"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
 
Line 4: Line 4:
 
== Infinite loop ==
 
== Infinite loop ==
  
[[go]]
+
=== [[go]] ===
 
<pre>
 
<pre>
 
package main
 
package main
Line 21: Line 21:
  
  
[[Bash]]
+
=== [[Bash]] ===
 
<pre>
 
<pre>
 
#!/bin/bash
 
#!/bin/bash

Latest revision as of 06:54, 3 March 2021


Infinite loop[edit]

go[edit]

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[edit]

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


Related terms[edit]

See also[edit]

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