The following condition:
if false
Will never be true so the code inside the if block
print("Will this line of code ever be reached")
someMethod()
Will never execute.
I have not read the book you are following. But it looks like the point of that code is to quiz you on whether the code in the if block will ever be reached, and not to build without any warnings.
If you want to remove the warning, provide a condition that could be true or false or remove the if statement and the braces. But I think removing the warning defeats the point of the exercise.
Topic:
Programming Languages
SubTopic:
Swift
Tags: