0

Batman swift function help

Hey, I’m trying to use a simple function to run the challenge weather to get help fighting crime with Batman or not. I havnt come across user input in swift so I think that may be the issue but any help is appreciated. I know it can be done without a function but still looks fun func batOrNot(x: Int) { if x < 5 { print("I got this!") } else if x <= 10 { print("Help me Batman") } else { print("Good luck out there!") } } var number: Int number = Input() batOrNot(x: number)

23rd Mar 2020, 7:17 PM
Alex Falla
Alex Falla - avatar
1 ответ
0
var number = Int(readLine()!)!
23rd Mar 2020, 8:18 PM
Mihai Apostol
Mihai Apostol - avatar