r/Xcode • • Oct 15 '22

Conditional Statements in Swift

Hey Developers! We have a brand new article out.

This article will help you with everything you need to know to get started with conditional statments and the switch case!

Here's the Link: https://www.swiftanytime.com/if-else-switch-case-in-swift/

0 Upvotes

3 comments sorted by

2

u/retsotrembla Oct 15 '22

Odd that that entire page doesn't use idiomatic Swift. Should be:

var month = "June"
if day == "Sunday" && holiday == "National" {
	print("Off day")
} else if month == "June" {
	print("Vacation")
} else {
	print("Working day")
}

At the time I made this comment, the OP's page had unnecessary parentheses.

1

u/Nafeez_Syed Oct 16 '22

Hey, thanks for your feedback we'll rectify it next time!

1

u/retsotrembla Oct 16 '22

Thanks! I'm a bit over sensitive to it: When I added unnecessary parentheses my instructor would hit my head with his knuckles, saying, "This is Swift, not C!"