C
C
Cobrak2022-02-17 15:01:08
go
Cobrak, 2022-02-17 15:01:08

Why does the IDE terminal freeze when I enter code?

Hello, I entered this code and the terminal just freezes, I tried to delete and practice another code, everything works, but it is on this terminal that it hangs and does not display anything. Can someone explain why?

package main

import "fmt"

var a float64

func main() {
xs := []float64{98, 93, 77, 82, 83}
for y := 0; y < 5; y++ {
a += xs[y]
}

fmt.Println(a / float64(len(xs)))
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2022-02-17
@Rsa97

Because it's an endless loop. The value of y never changes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question