[Solved] How to change what a string equals in a forloop [closed]
Just use a if condition. if (i == 1) { animal = “dog”; } else if (i == 2) { animal = “cat”; } Some additional comments: I would recommend using Enum instead of String. This: for(int puzzleNum = 1; puzzleNum <= NUMANIMALS; mazeNum++) looks like an infinite loop to me, as your puzzleNum doesn’t … Read more