Chapter 6 drills. Drill #7

Get help with Code for Teens
Katy
Posts: 4
Joined: Mon May 28, 2018 4:22 pm

Chapter 6 drills. Drill #7

Post by Katy » Tue Jan 08, 2019 6:14 pm

if ((!person2Age && person1Age) || person1Age > person2Age) {
whoseTurn = 1;

In this section does the does the (!person1Age && person2Age) mean that if person2 is not there person1 is older?

JeremyMoritz
Site Admin
Posts: 14
Joined: Mon May 14, 2018 10:19 pm
Location: Kansas
Contact:

Re: Chapter 6 drills. Drill #7

Post by JeremyMoritz » Tue Jan 08, 2019 9:34 pm

The full IF condition means "if there is NO person2Age, AND there IS a person1Age... OR ... if person1Age is GREATER THAN person2Age..."
Jeremy Moritz
Author of Code for Teens
www.CodeForTeens.com

Katy
Posts: 4
Joined: Mon May 28, 2018 4:22 pm

Re: Chapter 6 drills. Drill #7

Post by Katy » Wed Jan 09, 2019 5:32 pm

I understand now. Thanks!

Post Reply