Morse Decoder - Smelly code?

In the lesson for the Morse Decoder
https://www.codecademy.com/paths/build-ios-apps-with-swiftui/tracks/creating-user-interfaces-with-swiftui/modules/learn-swift-dictionaries/projects/swift-dictionaries-morse-decoder
So… the lesson has you set up a “switch” to append a " " to an array.

Here’s what they suggest:

switch currMorse {
case “”:
currMorse += " "
case " “:
morseCodeArray.append(” ")
currMorse = “”
default:
morseCodeArray.append(currMorse)
currMorse = “”
}

But the Code works fine without the cumbersome Switch function. Why is this a part of the lesson? What am I missing?

for char in secretMessage {
if char != " "{
currMorse.append(char)
} else {
morseCodeArray.append(currMorse)
currMorse = “”

switch is a useful tool to know. In some complicated scenarios it is far easier to read and organize (particularly when others have to read your code).

One gripe people have with python is lack of switch but I hear that’s coming soon…

Granted, it’s not completely necessary for code to work, but for certain situations it’s nice.

Yes switch is cool. But in this tutorial I was trying to understand why they called for switch. After working through it, I could not figure out what they were trying to accomplish by using it. As far as I can tell it doesn’t actually do anything useful and in fact I was able to meet the objective of the lesson by eliminating it entirely. Either I missed something and I hope to be corrected. Or others out there might have been confused by this too.