Batman swift function help | SoloLearn: Learn to code for FREE!


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)

3/23/2020 7:17:30 PM

Alex Falla

1 Answer

New Answer


var number = Int(readLine()!)!