Bronze Challenge

Review the switch statement below. What will be logged to the console? After you have decided, enter the code in a playground to see if you were right.

l​e​t​ ​p​o​i​n​t​ ​=​ ​(​x​:​ ​1​,​ ​y​:​ ​4​)​ s​w​i​t​c​h​ ​p​o​i​n​t​ ​{​ c​a​s​e​ ​l​e​t​ ​q​1​ ​w​h​e​r​e​ ​(​p​o​i​n​t​.​x​ ​>​ ​0​)​ ​&​&​ ​(​p​o​i​n​t​.​y​ ​>​ ​0​)​:​ ​ ​ ​ ​p​r​i​n​t​(​"​\​(​q​1​)​ ​i​s​ ​i​n​ ​q​u​a​d​r​a​n​t​ ​1​"​)​ c​a​s​e​ ​l​e​t​ ​q​2​ ​w​h​e​r​e​ ​(​p​o​i​n​t​.​x​ ​<​ ​0​)​ ​&​&​ ​p​o​i​n​t​.​y​ ​>​ ​0​:​ ​ ​ ​ ​p​r​i​n​t​(​"​\​(​q​2​)​ ​i​s​ ​i​n​ ​q​u​a​d​r​a​n​t​ ​2​"​)​ c​a​s​e​ ​l​e​t​ ​q​3​ ​w​h​e​r​e​ ​(​p​o​i​n​t​.​x​ ​<​ ​0​)​ ​&​&​ ​p​o​i​n​t​.​y​ ​<​ ​0​:​ ​ ​ ​ ​p​r​i​n​t​(​"​\​(​q​3​)​ ​i​s​ ​i​n​ ​q​u​a​d​r​a​n​t​ ​3​"​)​ ...

Get Swift Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.