Hey there my code does not seem to enter the for loop (with the i:=0;i>3;i++). I have no idea why. Cant seem to figure out why it just skips over it.
func main() {
file, err := os.Open("input.txt")
if err != nil {
fmt.Println("Error, reading file")
fmt.Println(err)
}
defer file.Close()
scanner := bufio.NewScanner(file)
const maxCapacity int = 200000
buf := make([]byte, maxCapacity)
scanner.Buffer(buf, maxCapacity)
var group1 int
fmt.Println("before the loop")
for i := 0; i > 3; i++ {
fmt.Println("Inside the for loop")
for scanner.Scan() {
fmt.Println("Were inside the 2nd for loop")
x, err := strconv.Atoi(scanner.Text())
fmt.Println(x)
if err != nil {
fmt.Println("Error converting number inside the 3Adding loop")
}
group1 += x
}
fmt.Println("Inside for loop but at end")
}
}