0
Why can my function not recognize my variable it that is made from my if/else function?
4 Answers
+ 8
You should declare variable first then use it in condition. Do like this
String it = "";
if (x > 0) {
it = "positive";
} else {
it = "negative";
}
return it;
+ 6
David Nierman It's printing positive. You did again wrong. Check my previous reply. Why did you declare static.
+ 2
AJ #Level 20 End Game ahh my bad, I accidentally declared it multiple times as a string..
I declared static to learn how to use static
+ 1
Thanks AJ #Level 20 End Game ! Follow up question..why will it not print positive ?