I don't understand the meaning of 10<3


Hello !

i don't understand the meaning of 10<3 in the if/else statement, what mean the 10 and what mean the 3 ? can someone have an explanation ? thx :wink:

Why when I use the booleans for making my name bubbly, the code says 10 >3 is true, but the how to says it is false?

They are just numbers. They could just as well have been other numbers.

This is how if/else statements work:

    if (this expression is true) {
        do this thing;
    } else {
        do this other thing;

The point of those numbers here is that 10<3 is always false which means that the else block of your if/else statement will always be processed. You could put anything that evaluates to false as your expression to get the same results.

In real life, you are not likely to use an expression like that. You would instead do something like age < 21 or password.length > 10.


Ahh Okay ! understand now :smile: . may be if we put a condition like that i would understood that " if (name.length<10 ){}else{} . Thanks for the answer !


10 < 3
Ten is less than three.

The if/else statement is checking whether 10 < 3 is true or not. As it's not true, the code block in the 'else' part of the if/else will run.