enums and protocol | Sololearn: Learn to code for FREE!


enums and protocol

can anyone explain how to use it!?

7/3/2016 9:41:12 PM

Ahmed Jaffer Elgassim

2 Answers

New Answer


enum { case North case South case East case West }


Here is a chunk of code That I created for you. It moves a character back and forth 3 times printing when the edge of the screen is reached and switch the direction. After the third iteration it stops and tellls that the race is completed: http://swiftlang.ng.bluemix.net/#/repl/57c64a92c62de72752d32274