0
Why the if is executing ? Help !
4 Answers
+ 3
if(3<x.length<6){
3 < 1 -> false (0)
0 < 6 -> true
This condition will always be true...
If you want to check if the kength is between 3 and 6 do:
If ( (3 < x.length) && (x.length < 6) )
+ 3
Maybe you want to reformulate your condition like this:
if(4<x.length && x.length<6)
0
Because the length is less than 6
0
But the length is also less than 4.
and the if condition is greater than 4 and less than 6.
then also if is executing !