Skip to content

泛型一节中语法错误 #352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wwq0327 opened this issue Apr 4, 2015 · 1 comment
Closed

泛型一节中语法错误 #352

wwq0327 opened this issue Apr 4, 2015 · 1 comment

Comments

@wwq0327
Copy link

wwq0327 commented Apr 4, 2015

func findIndex<T>(array: T[], valueToFind: T) -> Int? {
    for (index, value) in enumerate(array) {
        if value == valueToFind {
            return index
        }
    }
    return nil
}

这里的函数参数array,类型应该为[T]

@numbbbbb
Copy link
Member

已修改,多谢!

chenranj pushed a commit that referenced this issue Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants