Created
May 3, 2018 12:34
-
-
Save DmitryOlkhovoi/27ceb95366b989adcbb23fd251d833d4 to your computer and use it in GitHub Desktop.
Cars creator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.swift | |
// Cars creator | |
// | |
// Created by Dmitry Olkhovoi on 5/3/18. | |
// Copyright © 2018 Dmitry Olkhovoi. All rights reserved. | |
// | |
var cars = [String]() | |
var exit = false | |
print("Hello, type in a command:") | |
while !exit, let cmd = readLine() { | |
switch(cmd) { | |
case "add": | |
print("Type in a name of the car:") | |
cars.append(readLine()!) | |
case "show": | |
print(cars) | |
case "q": | |
exit = true | |
print("Bye!") | |
default: | |
print("Undefined command!") | |
} | |
print("Command:") | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment