"let sale = true", then "sale = false"?

Hii, I’m currently doing the Codecademy “if…else” statement task - the code works fine, I’m just a little confused about one thing…

Why do I have to have to set let sale = true;, only to change it right after to “false”?

let sale = true;

sale = false;

I’ve gotten rid of sale = false; and it still works perfectly. Why do I need to set a value only to instantly change it?
Why can’t I make the sale false to begin with?

Thank you so much in advance! My brain is dying with this lol

Hi there!

Are you talking about this lesson? If so, it’s to show you how the behavior works when the boolean value changes. :slight_smile:

1 Like

Thank you for responding! :slight_smile: I’m doing the Conditionals lesson - here’s the link::
https://www.codecademy.com/courses/introduction-to-javascript/lessons/control-flow/exercises/if-else-statements

Maybe the same concept is in the lesson you provided, I’m not sure - though your explination would make sense if that’s the case :sweat_smile:

2 Likes