+ 1
Can someone help me with a project of mine also? Read description
I'm making a little game for practice and to challenge myself. The problem is, it says variable already listed, but I want the users to know what type colors they pick. Just read my intention in the code, thanks also for those who have helped me out and will. https://code.sololearn.com/c91Ad2Yzt221/?ref=app
2 Answers
+ 7
String color = "Red";
String color = "Yellow";
String color = "Green";
String color = "Blue";
String color = "Orange";
You're redeclaring the variable named color here.
You could name the variable by its color name or create an array of colors instead.
String red = "Red";
or
String[] colors = {"Red", "Yellow", "Green", ...};
+ 2
Ok thank you