This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Animate Your Name Forum

View Course » View Exercise

294 points
F2746d09a5dfe10823e1010dbc784116?s=140&d=retro
Submitted by
Fadman
over 3 years ago

what does 10<3 apply To?

if (10<3){

}

What or where is it checking for 10<3??
What i the difference between 10<3 and 20<6??


0 votes

permalink

Hi Fadman,

You can have your program do different things depending on whether a condition of your choosing is true or false.

Here is how if/else statements work:

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

Here is the example for this exercise. It says that if 10 < 3 is true then your shapes will be circles, otherwise they will be squares.

if (10 < 3) {
    bubbleShape = "circle"; 
} else {  
    bubbleShape = "square";
}

You can alter the (conditon) to be anything you wish.

3698 points
55df2afa95e3787b9200005e_359368177
Submitted by
Judy
over 3 years ago

3 Comments

F2746d09a5dfe10823e1010dbc784116?s=140&d=retro Fadman over 3 years ago

Thanks, I should have clarified myself more, I know how if statements work, I just don't know what the number 10 refers to and what the number 3 refers to.

55df2afa95e3787b9200005e_359368177 Judy over 3 years ago

They don't refer to anything in particular. In this case since we want circles we need something that is true, which 10 < 3 is not. You could pick any true expression, 10 > 3 or 5 > 6 or 7 === 7 ... etc.

55df2afa95e3787b9200005e_359368177 Judy over 3 years ago

Hi Fadman, I didn't answer this question directly: "What is the difference between 10<3 and 20<6?" There is no difference, they are equal, both of those evaluate to true. Are you still stuck?