How can I change the Double value in my dictionary outside the function?
<pre><code>var grades: [String : Double]

grades = ["A": 0.0, "A-": 0.0, "B+": 0.0, "B": 0.0, "B-": 0.0, "C+": 0.0, "C": 0.0, "C-": 0.0, "D+": 0.0, "D": 0.0, "D-": 0.0, "F": 0.0]

func calcGPA() {

if let a = grades["A"], amin = grades["A-"], bplu = grades["B+"], b = grades["B"], bmin = grades["B-"], cplu = grades["C+"], c = grades["C"], cmin = grades["C-"], dplu = grades["D+"], d = grades["D"],    dmin = grades["D-"], f = grades["F"] {

        // Divide by this
        let gradesAdded = a + amin + bplu + b + bmin + cplu + c + cmin + dplu + d + dmin + f
        //grades multiplied by their values and added ex. a * 4.0 + amin * 3.7
        let gradesCalculated = a * 4.0 + amin * 3.7 + bplu * 3.3 + b * 3.0 + bmin * 2.7 + cplu * 2.3 + c *  2.0 + cmin * 1.7 + dplu * 1.3 + d * 1.0 + dmin * 0.7 // Dont do F because it would just add 0
        var gpa = gradesCalculated / gradesAdded

        if gpa.isNaN {
            gpa = 0.0
        }
    }
}
</code></pre>

<p>Is there a way to do something like grades["A"] += 1.0 so that it goes up by one and I can call calcGPA()? I can't figure out how to make this work. Any help on this would be awesome</p>