12. Decisions, decisions: why does 10>3 matter?



I'm not getting any error messages, the code is fine: this is more of a "when will I use this in the future?" But I just wonder what the point is in adding if(10<3), an obviously true statement, which does nothing but be obviously true. Under what circumstances would I change that if/else? For example, wouldn't it be a better lesson to use an if/else like


So that "Meghanne" yields circles, but "Megan" would show as square?

Original code:

var red = [0, 100, 63];
var orange = [40, 100, 60];
var green = [75, 100, 40];
var blue = [196, 77, 55];
var purple = [280, 50, 60];

var myName = "Meghanne";

drawName(myName, letterColors);


The true statement is just so it is guaranteed to show true, and make it circles vs squares, because 10 > 3 will always be True. :smirk:


But I don't think I've really learned anything about why I would need to use the if/else function by merely entering a statement that will never affect the "else." Would I ever do this in any other situation? It makes else{bubbleShape="square"} a useless line of code.


you could just have an if, remove the else and it should work fine?


This is just a small project to lure you into wanting to learn more. Many things were glossed over and done for you behind the scenes. Take the JavaScript course to learn more about if/else and lots more. :grinning:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.