title: Kotlin Global Variable Showing As Zero "0"
body: <p>I am a complete beginner and have started to learn Kotlin via YouTube tutorials and Google searching for specifics.
  When I was following a tutorial, he created three variables inside the <code>MainActivity</code> class as the following</p>
  <pre><code>class MainActivity : AppCompatActivity() {
  
  var firstName= &quot;David&quot;
  var secondName= &quot;Tal&quot;
  var age = 20
  
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_main)
  }
  </code></pre>
  <p>Next, he uses the created variables in a private function like this:</p>
  <pre><code>private fun nameRating(){
     if(firstName == secondName){
        Toast.makeText(applicationContext,&quot;10/10&quot;, Toast.LENGTH_LONG).show()
     }else{
        Toast.makeText(applicationContext,&quot;5/10&quot;, Toast.LENGTH_LONG).show()
     }}
  </code></pre>
  <p>I followed the example and recreated it in Android Studio, but the if condition triggered, and I thought it was weird. After debugging it turned out that both <code>firstName</code> and <code>secondName</code> are <code>&quot;0&quot;</code>. I thought the variables were supposed to be global, and it is confusing why it is not working because the <code>age</code> variable is correct.</p>
  <p>If I am completely wrong on how this should work, any explanation/clarification on the matter would be appreciated.</p>