title: Does declaring a variable as optional incurs any additional cost in swift?
body: <p>As per my boss, if I am initialising a variable in init, I should not declare it as optional and he thinks book on swift says that. </p>
  
  <p>Now I haven't came across the same statement anywhere hence wondering is he correct or not.</p>
  
  <p><strong>OverView:</strong></p>
  
  <p>As I come from an Object oriented Objective C programming background, it is my hobby to declare the variables to their initial values as soon as I declare it (most of the Stanford university videos on Objective C said the same thing) Now objective C used to allow a nil value to the variables and if I want to assign the same nil value as initial value to some variable in swift I need to declare it as optional, I know that if I declare a variable and won't initialise it in init I'll get error from compiler,</p>
  
  <pre><code>struct TestStruct {
      var name : String? = nil
      var age : Int
  
      init(){
          name = "Sandeep"
          age = 26
      }
  
      func printInfo(){
          print(self.name! + "\(self.age)")
      }
  } 
  </code></pre>
  
  <p>In the above code I have name declared as optional and set nil as default value where as age is defined as Int and initialised to proper value in init.</p>
  
  <p><strong>Question</strong></p>
  
  <p>Knowing that both work, </p>
  
  <p>1.Is it wrong if I declare a variable as optional and then use ! or ? to access it even though I initialise it in init??</p>
  
  <p>2.Is it true that swift specifies that I should not use ? or ! for the variables ? If yes is there any added computational cost to it ?</p>
  
  <p>I know it is not a complicated question, I just wanna know what I am doing is anyway wrong? </p>
  
  <p>Thanks in advance.</p>