UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Day 9: Referring to the current instance, Test Q.2 Potential Error

Forums > 100 Days of SwiftUI

First time posting. I think I have found a potential error in Q.2 of the Referring to the current instance test, I say potential because I am fairly new at coding and could be looking at it wrong. Anyway, the answer to [Q.2] (https://www.hackingwithswift.com/review/referring-to-the-current-instance) is true, but I believe it should be false because the second parameter of the initializer is superPowers not powers so .self is not needed when referring to the property powers. Other questions in the test do this same thing and thier answer is false. If I am wrong please explain to me how, I've taken the test 3 times now because of that one question, trying to figure out what I am missing. Thank you.

2      

self is not needed there, but it isn't an error to include it. The code is valid Swift.

2      

I understand now. I retook the test and read the answers for the other questions that I had mentioned and realized that I hadn't read them carefully enough. Thank you for the help.

2      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.