I understand that i < 10 could be 2,6 but there bis int i =0 before while. Can somebody explain it.
pl/codegym/task/task03/task0314/Solution.java:11: error: bad operand types for binary operator '&&'
while( i < 10 && i++ ) {
^
first type: boolean
second type: int
What is wrong?
Dyskutowane
Komentarze (1)
- Popularne
- Najnowsze
- Najstarsze
Musisz się zalogować, aby dodać komentarz
Gellert Varga
4 maja 2020, 20:01
A) "I understand that i < 10 could be 2,6 but there bis int i =0 before while. Can somebody explain it. "
- I don't understand it while i can't see the program. For understanding You must to add the whole code.
B) but if you wrote this in the code:
'while( i < 10 && i++ )'
then the problem is this:
The '&&' operator can do a comparison between two boolean types:
1) The 'i<10' is a boolean. True or false condition.
2) The 'i++' is not a boolean. It's an incemenenter operation. You can not do a comparison to this.
0