我的for循环由于我的if语句而停止处理

I wanted to get all of my positions using for loop

for i := 0; i < len(word)-1; i++ {

    j := i + 1

    fmt.Println(i, j)
}

if I just process the above function, the outputs are what I wanted until, I started inserting this if statement

if word[i]-word[j] == 0 || word[i]-word[j] == 1 || word[i]-word[j] == 2 || word[i]-word[j] == 3 || word[i]-word[j] == 255 || word[i]-word[j] == 254 || word[i]-word[j] == 253 {
    return word
} else {
    return " "
}

My for loop stops after only processing one letter in the word, which is 0 from i and 1 from j

you if and else call return and return a value, when return is used it will exit the function and return a value

if you use fmt.Println() instead of return everything will be printed