| Author |
problem with int and for statement
|
levi sleight
Greenhorn
Joined: Sep 19, 2012
Posts: 19
|
|
ok so im trying to make a simple text adventure. and i have a slight problem. youll see
the problem is that on the 31st line it gives me an error saying "cannot convert int to boolean" ... so i turned it into a boolean, but (i know im a noob) I dont know how to use those so
i changed it back because it said the reverse, on the 43 line, how can i use an int or double in an if statement
|
 |
Kemal Sokolovic
Bartender
Joined: Jun 19, 2010
Posts: 792
|
|
There is a difference between an assignment operator (=) and relational equal to operator (==). The first one cannot be used in if statement, so:
is not valid.
|
The quieter you are, the more you are able to hear.
|
 |
levi sleight
Greenhorn
Joined: Sep 19, 2012
Posts: 19
|
|
|
i, i may be one of the stupidest people i know
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 9939
|
|
|
you and probably half the people here have made that exact same mistake.
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
levi sleight
Greenhorn
Joined: Sep 19, 2012
Posts: 19
|
|
|
lol, i just was about to post another question, because i had another problem with the switch(on a side note, a switch statement inst a loop is it?) and i looked through it 10 times, i felt pretty dumb when i realized that i just didnt have a default with another Chose.nextLine in it, nother question, is this the majority of messups in java? me ripping out my hair over 2 lines?
|
 |
R. Jain
Ranch Hand
Joined: Aug 11, 2012
Posts: 276
|
|
levi sleight wrote:i looked through it 10 times, i felt pretty dumb when i realized that i just didnt have a default with another Chose.nextLine in it, nother question, is this the majority of messups in java? me ripping out my hair over 2 lines?
And that's how you learn Java.. Unless you pluck 2-3 of your hairs, you will not improve better..
|
OCPJP
|
 |
Kemal Sokolovic
Bartender
Joined: Jun 19, 2010
Posts: 792
|
|
|
Can't help but notice that this topic has nothing to do with for statement.
|
 |
levi sleight
Greenhorn
Joined: Sep 19, 2012
Posts: 19
|
|
|
lolololol
|
 |
 |
|
|
subject: problem with int and for statement
|
|
|