loop bug

 for i = 1, string.len(motCorrectMin) do print("in addgamescreen loop") lesMaj = string.sub(motCorrect, i, i) if lesMaj == string.upper(lesMaj) then motCorrectLettresMaj[i] = 1 end if lesMaj == string.lower(lesMaj) then motCorrectLettresMaj[i] = 0 end lettreCourante = string.sub(motCorrectMin,i,i) lettre[i] = display.newImageRect("lettre\_" .. lettreCourante ..".png", 50, 50) lettre[i].lettre = lettreCourante lettre[i].numI = i lettre\_maj[i] = display.newImageRect("lettre\_".. lettreCourante.."\_majuscule.png", 50, 50) --print("lettre\_maj[i] " .. "lettre\_".. lettreCourante.."\_majuscule.png") --print("lettreCourante " .. lettreCourante) --print("i " .. i) lettre\_maj[i].lettre = lettreCourante.."\_maj" lettre\_maj[i].numI = i if i == 1 then print("in line 180") longueurPar2 = longueur / 2 --W\_ calcul = taille \* longueurPar2 pos\_x = W\_ - calcul --print(pos\_x.." "..i) else if i == 2 then print("in line 188") pos\_x = W\_ - (taille \* (longueurPar2 - (i - 1))) else print("in line 192") pos\_x = W\_ - (taille \* (longueurPar2 - i)) --it stops reading the code here print("in line 206") lettre[i].x = pos\_x lettre[i].y = H\_ lettre[i].name = lettre[i] lettre[i].isVisible = true lettre\_maj[i].x = pos\_x lettre\_maj[i].y = H\_ lettre\_maj[i].name = lettre\_maj[i] lettre\_maj[i].isVisible = false gameScreenGroup:insert(lettre[i]) gameScreenGroup:insert(lettre\_maj[i]) if lettre[i].isVisible == true then lettre[i]:addEventListener("tap", letterTapped) end end end end

Hi pls help.

I have this code in a loop and for some reason it doesn’t read the whole thing. I marked the spot in the code. If you need any other part of code ask.

I hope someone will have an idea to fix my bug.

On this line:

   else if i ==2 then

I think you might have meant elseif (all one word).

Oh ok now i understand ! It was actually just a synthaxe error. Thanks for your help.

On this line:

   else if i ==2 then

I think you might have meant elseif (all one word).

Oh ok now i understand ! It was actually just a synthaxe error. Thanks for your help.