Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Can I please get help with this proactice project
I was putting in my solution into the playground, this is what I typed:
let distanceBetweenX = towerX - enemyX let squaredXDistance = distanceBetweenX * distanceBetweenX let distanceBetweenY = towerY - enemyY let squaredYDistance = distanceBetweenY * distanceBetweenY let sumOfSquares = squaredXDistance + squaredYDistance
The results for 4 of the constants did not print in the REPL. Only for the first constant. I also received an error in the debug area:
libc++abi.dylib: terminating with uncaught exception of type NSException
I am using Swift 4. Can someone please explain why this did not work in my IDE?
Also, I feel like the jump from learning the operators to jumping right into such complex arimathic solutions was rather jarring and overwhelming. Thank you.
Meg Dooley7,321 Points
I copied your code into my more recent version of Xcode (10.0) and it worked fine so it might be a bug? Also - I often get overwhelmed by the math based challenges too so I usually spend some time googling the arithmetic needed before I attempt them. I felt a bit disheartened at first that I had to do that but there's really no need to be, most of us haven't even thought about math since we left school after all! I also find it handy to write down useful math formulas as they come up and post them to my desktop or sometimes on post-it notes on the wall behind my laptop so i can easily remind myself of what to do if I need it for a future code challenge. Hope that helps!