# Conditional Statements

Hello, can someone help explain this basic problem on conditional statements? It is a problem from a quiz section. I did not quite understand the answer when first was presented to me to solve. Then the second time I already knew the answers because the first time was wrong.

Here is a link to the problem as well. Thank you.

What will the code block log to the console?

let runTime = 35;
let runDistance = 3.5;

if (runTime <= 30 && runDistance > 3.5) {
console.log(â€śYouâ€™re super fast!â€ť);
} else if (runTime >= 30 && runDistance <= 3) {
} else if (runTime > 30 || runDistance > 3) {
console.log(â€śNice workout!â€ť);
} else {
console.log(â€śKeep on running!â€ť);
}

1 Like

Letâ€™s see. In each condition we are checking both the `runTime` and the `runDistance`.

First, we check if the `runTime` is less or equal to 30 and the `runDistance` is bigger than 3.5. If those conditions are both true, we log â€śYouâ€™re super fast!â€ť.

And now, what if the `runTime` is bigger than or equal to 30 and the `runDistance` is less than or equal to 3? Then we would log â€śYouâ€™re not making your pace!â€ť.

Now, what if, the `runTime` was bigger than 30 or the `runDistance` was bigger than 3? Then we would log â€śNice workout!â€ť.

And in every other possible case, weâ€™ll log â€śKeep on running!â€ť.

In this case, the values of our variables would fall into the third condition, therefore we would log â€śNice workout!â€ť.

Hope this helped

1 Like

Thank you. It did helped. I looked at this problem a second time and able to understand it better. Have you been in the focus sessions ? students meet Wednesday and Fridays at 12noon pacific time for web development. I am planing to join Wed. It is over zoom meetings.

1 Like

Nope, and I have never been in a zoom meeting before lol. I would have to show my face, right? Iâ€™m not very comfortable with that idea Also, 12PM Pacific isnâ€™t much of a good time for me where I live lol.

But I hope you have fun!

Are you familiar with functions? I got this one from the JS practice.

Which of the following is NOT a properly written arrow function?

let nameLogger = (name) => { console.log(`Hi, my name is \${name}.`); }

let phraseSplit = phrase => phrase.split(" ")

let multiply = (x, y) => x * y

let fileName = function(x) => console.log(`File name is \${x}`);

No worries.
What country are you located ?

Yep, I am. Itâ€™s the last one, right? The last one is not a properly written arrow function (cause you donâ€™t need to use the `function` keyword with arrow functions).

I live in Mexico. (It looks like my post must be at least 20 characters so yeah )

Yes, you are right. I got it wrong 2 times from the practice. I am studying functions now. The helper functions is confusing now. Not getting it yet.

Amazing. I grew up in Mexico. In the state of Michoacan but moved to the US when I was a teenager. Are you Mexican or other Nationality but living in Mexico? When I was in primary school in Michoacan I had some classmates kids who were Americans(white).

Helper functions are basically just functions you call inside another function. They help break big tasks into chunks, so you donâ€™t need to have a BIIIIG function that does the full task. Instead you have many smaller functions that you can call inside one another, and that makes your code way more manageable.

Hope that helped

Woah thatâ€™s such a cool coincidence lol
Nah, I am Mexican. And as a fun fact, I have never traveled to any other country And now, Iâ€™m not sure I ever will

Hi, how have you been? I canâ€™t believe is has been 7 days since we last talked. I kind of slowed down with my studying here. Been kind of tired and busy.

1 Like

Hiii! Itâ€™s been 7 days? Dang.
Iâ€™ve been great, Iâ€™m getting vacations next week (if I pass my exams) so Iâ€™ve been trying to make an activities planner for my 1-week vacations. Which Iâ€™ll be spending at home lol

Aw that sucks I hate being tiredâ€¦but Iâ€™m tired most of my life

How was your vacation? staycation in other words. I have a question about codecademy. Do you know if the people in the forums who help with questions are all students ? Is there any teacher support on the forums to help with questions?

Hi! It was great, I really enjoyed it. I improved so much with my art.

Hmmâ€¦well, I do know @mtf is not a student, and he knows a lot of stuff. But other than that Iâ€™m not sure honestly.

A good many of the learners are still in school right up to college and university. Technically weâ€™re all students of coding.

No, there are no teachers, as such. Weâ€™re all volunteers with the same basic aimâ€¦ Learn to code and help guide others while we maintain the forums. CC does have teachers on staff but their roles are curriculum based.

2 Likes