so I'm working on an activity and I need help on figuring out how will i get a string that inside a while loop. The code below is just a part of my activity so please disregard the doubles and char The code:
import java.util.Scanner;
public class ignCalcu {
public static void main (String[] args){
Scanner input = new Scanner(System.in);
char operator;
Double num1, num2, answer;
System.out.println("Welcome to CalcuLegends!");
while (true){
System.out.println("Before you use the Calcore, would you like to set an IGN first?");
System.out.println("Yes or No?");
String start = input.nextLine();
if (start.equals("Yes") || start.equals("yes")){
System.out.println("What is your favorite color?");
String color = input.nextLine();
System.out.println("What word describes you the best?");
String word = input.nextLine();
System.out.println("What is your favorite animal?");
String animal = input.nextLine();
String ign = (" "+color+"_"+word+"_"+animal+" ");
System.out.println("Hi" + ign + "! You are now using Calcore.");
break;
}
System.out.println(ign);
}
}
}
And here is the error:
source_file.java:26: error: cannot find symbol System.out.println(ign);
Symbol: variable ign
location: class ignCalcu 1 error