I am working my way through a Swift course from 2015. It is asking me to "Write a function called magicEightBall that generates a random number and then uses either a switch statement or if-else-if statements to print different responses based on the random number generated. let randomNum = Int.random(in: 0...4) will generate a random number from 0 to 4, after which you can print different phrases corresponding to the number generated. Call the function multiple times and observe the different printouts."
Here is what I have written so far, but it isn't working:
func magicEightBall(randomNum: Int) {
let randomNum = Int.random(in: 0...4)
print(randomNum)
}
magicEightBall()
I keep getting an error that says "Missing argument for parameter 'randomNum' in call
any help would be greatly appreciated, Thank You
Here is what I have written so far, but it isn't working:
func magicEightBall(randomNum: Int) {
let randomNum = Int.random(in: 0...4)
print(randomNum)
}
magicEightBall()
I keep getting an error that says "Missing argument for parameter 'randomNum' in call
any help would be greatly appreciated, Thank You