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
Aucun commentaire:
Enregistrer un commentaire