title: Keyword var required in front of struct value type when used as a parameter in a function
body: <p>Why is the keyword var required in front of a struct's value type parameter when used in a function?</p>
  
  <pre><code>struct MyValueType {
      var name:String
      var assignment:String
      var grade:Int
  }
  
  class MyReferenceType{
      var name:String
      var assignment:String
      var grade:Int
      init(name:String,assignment:String,grade:Int){
          self.name = name
          self.assignment = assignment
          self.grade = grade
      }
  }
  
  var myRef = MyReferenceType(name:"Jon",assignment:"Math Test 1",grade:90)
  
  print(myRef.assignment)
  func extraCreditReferenceType(ref:MyReferenceType,extraCredit:Int){
      ref.grade += extraCredit
  }
  
  func extraCreditValueType(var val:MyValueType,extraCredit:Int){
      val.grade += extraCredit
  }
  
  var ref = MyReferenceType(name:"Jon",assignment:"Math Test 1",grade:90)
  
  print(ref.grade)
  extraCreditReferenceType(ref,extraCredit:5)
  print("Reference: \(ref.name) - \(ref.grade)")
  
  
  
  var val = MyValueType(name:"Jon",assignment:"Math Test 1",grade:90)
  extraCreditValueType(val,extraCredit:5)
  print("Value: \(val.name) - \(val.grade)")
  </code></pre>
  
  <p>The line in question is the following function:</p>
  
  <pre><code>func extraCreditValueType(var val:MyValueType,extraCredit:Int){
      val.grade += extraCredit
  }
  </code></pre>
  
  <p>By removing the keyword var, the code won't compile.</p>