Swift 2 unused constant warning
问题 I am getting a warning saying my constant is unused: Initialization of immutable value 'myConst' was never used; consider replacing with assignment to '_' or removing it if someVal["value"] != nil { let myConst = someVal["value"] } So what will renaming let myConst = someVal["value"] into _ myConst = someVal["value"] do/mean? 回答1: You're not replacing let with _ , but you're replacing the variable name with it. If the variable isn't used anywhere in the code it's irrelevant so the line can be