Integer sequence: Difference between revisions

Content deleted Content added
Forth
Sonia (talk | contribs)
Go solution
Line 155:
=={{header|Forth}}==
<lang forth>: ints 0 begin 1+ dup u. cr dup 0= until drop ;</lang>
=={{header|Go}}==
Size of int type is implementation dependent, but I think all implementations use 32 bits currently. After the maximum positive value, it rolls over to maximum negative, without error.
<lang go>package main
 
import "fmt"
 
func main() {
for i := 1;; i++ {
fmt.Println(i)
}
}</lang>
The big number type does not roll over and is limited only by available memory, or practically, by whatever external factor halts cpu execution: human operator, lightning storm, cpu fan failure, heat death of universe, etc.
<lang go>package main
 
import (
"big"
"fmt"
}
 
func main() {
one := big.NewInt(1)
for i := big.NewInt(1);; i.Add(i, one) {
fmt.Println(i)
}
}</lang>
 
=={{header|Haskell}}==