Day 3: Logic
Congratulations on finishing another day 😀
Conditional logic and this kind of flow control is a big part of programming and, while it might seem confusing right now, in time it will become second nature.
This is the first time we have taken an earlier concept, booleans (true/false), and combined it with something new so if you're brain is spinning that's to be expected.
To wrap up today I have a small task for you to complete. In the playground below we have 2 weather inputs,
temperature can be any number and
conditions can be any of:
Based on the conditions and temperature we need a script that will
console.log() a message for what to wear. Let's keep it to 6 outputs so it's not too much code, the clothing advice will be:
|Where Are You?
Once you've got that working, then add an override variable called
bothered === true then run through the above code and
console.log() the result. If the user is not bothered (
=== false) then skip the whole section and
console.log() "Best of luck!"
(Remember you can make the coding playground area wider by hovering on and dragging the vertical divider)