/** * Compute some fibonacci numbers * Shows the use for for loops, if statements and Printf * * @author gtowell * Created: Sep 1, 2021 **/ package main import "fmt" func main() { ii,f1, f2 := 0,1,1 for { // go does not have a while loop! Just for with nothing (or ;;) ii++; f1,f2 = f2, (f1+f2) if (f2<0) { break } fmt.Printf("%d %d %d\n", ii, f1, f2) } }