Why is "ambiguous use of 'functionname'" appearing in swift?


func display() -> Int {
    return 5
func display() -> String {
    return "Hello"
let value = display()
This error comes up when there are multiple functions with the same name, and Swift can't determine which one you want to use.


// Rename one of the functions or specify return type
let value: Int = display()

Beginner's Guide to Swift