func gradeCalc(_ score: Int) -> String { (0...100~=score) ? ["F","F","F","F","F","F","D","C","B","A","A"][score / 10] : "Not a grade" }
- func gradeCalc(_ score: Int) -> String {
(score < 0 || score > 100) ? "Not a grade" : ["F","F","F","F","F","F","D","C","B","A","A"][score / 10];}- (0...100~=score) ? ["F","F","F","F","F","F","D","C","B","A","A"][score / 10] : "Not a grade"
- }
Fundamentals
Arrays
Data Types
The same stuff in one line, using reduce
enstead of forEach
.