Created
October 21, 2016 13:26
-
-
Save mzaks/d930fb1d2abe7350bf7d57a55d094f3a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| struct HaveYoutriedToTurnItOffAndOnAgain : Action { | |
| func execute(data: String, callback: @escaping (DataType, BehaviourResult) -> ()) { | |
| print("Have you tried to turn it off and on again?") | |
| callback(data, .succeeded) | |
| } | |
| } |
This file contains hidden or 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
| struct YesNoQuestion : Action { | |
| func execute(data: String, callback: @escaping (DataType, BehaviourResult) -> ()) { | |
| print("[yes/no]") | |
| if let answer = readLine(), answer == "yes" { | |
| callback(answer, .succeeded) | |
| } else { | |
| callback(data, .failed) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment