You should declare the variables at the top and give them initial values.
I cannot firgure out how to correct my code i keep getting the error
GoldVsRed.java:74: variable RedHealth might not have been initialized
int difficulty = input.nextInt();
if (difficulty == 1){
int RedHealth = 50;
int GoldHealth = 75;
}
if (difficulty == 2){
int RedHealth = 50;
int GoldHealth = 50;
}
if (difficulty == 3){
int RedHealth = 75;
int GoldHealth = 50;
}
int RedHealth;
int GoldHealth;
/* Flamethrower = 5;
Rollout = 10;
Swift = 15; */
int goldAttack = input.nextInt();
System.out.println("Choose Your First Move Gold:");
System.out.println("(1) Flamethrower");
System.out.println("(2) Rollout");
System.out.println("(3) Swift");
if (goldAttack == 1){
System.out.println("Typhlosion used Flamethrower!");
System.out.println(RedHealth - 5);
}