#if statement scope thingy
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
in this case dont use an if else in the first place
boolean repeat = repeatInput.equalsIgnoreCase("y");
What's stopping you from doing this?
Otherwise you can declare the variable before the block boolean repeat;
there are many layers to this
the first layer:
when you declare a variable, it exists in the scope it was declared
you could declare the variable outside of the if, then assign it in the if
once you've solved that, can move onto the next layer (which is what others are talking about)