If/else statements are the bane of my existance!


#1

Okay, for some reason, I just am not able to get the if/else statements. I struggled with it when I got to that lesson and now that I'm at the end of the course, nothing I do is accurate. I do what the prompts tell me to do after I submit, however, now all it is saying is that something is wrong with my Syntax (a common thing when I was learning if/else statements...Totally blaming myself on this one, not the lesson. There must be something here that I am just not grasping. please help explain if/else statements.


#2

This is how if/else works:

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

    if (it is raining) {
        wear boots;
    } else {
        wear sandals;
    }

    if (it is raining) {
        wear boots;
    } else if (it is hot) {
        wear sandals;
    } else {
        wear shoes;
    }

#3

that definitely make a lot more sense. Thank you!!!


#4

I was able to complete it this time, no mistakes. Again, like I said, not the lesson's fault...just a regular User error, or as I like to call them, an ID10T code! ha ha ha


#5

Good work getting it done!


#6

I clearly underestimated Java when I switched from HTML & CSS right into Javascript. I think, aside from the first two sections of the first lesson I was still in CSS mode and had to quickly change my mindset to Learn the new language. But then again, I've always been the type to jump right in feet first and confront the consequences after, when it comes to learning new things at least.


#7

Learning a programming language is definitely a different thing than learning a markup language. They become very intertwined if you stick with it.

Unfortunately you can't just reset the whole JS course in one go - repetition helps with these things. You can reset it one exercise at a time or create a new account to do it again. You'll be surprised what stuck and what didn't.


#8

A post was split to a new topic: Problem with if-else statement


#9