// LikeswiftSwitch.swift Copyright (c) Kari Laitinen // http://www.naturalprogramming.com // 2014-09-30 File created. // 2015-10-17 Last modification. /* This program works in the same way as Likeswift.swift In this version a switch-case construct is used to make decisions. */ import Foundation print( "\n Do you like the Swift programming language?" + "\n Please, answer Y or N : ", terminator: "" ) // Although the name of the following variable says // 'character' we will receive a String from the keyboard. var character_from_keyboard : String! = readLine() switch character_from_keyboard { case "Y", "y" : print( "\n That's nice to hear. \n" ) case "N", "n" : print( "\n That is not so nice to hear. " + "\n I hope you change your mind soon.\n" ) default: print( "\n I do not understand \"" + character_from_keyboard + "\".\n" ) }