Can someone help me with a project of mine also? Read description | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

11th Feb 2018, 6:48 PM
Jaren Dogan
Jaren Dogan - avatar
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", ...};
11th Feb 2018, 7:01 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Ok thank you
14th Feb 2018, 1:16 AM
Jaren Dogan
Jaren Dogan - avatar