[アンドロイド3日目]Log,for反復文,変数型


package com.jeongyoung.sayhello

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import com.jeongyoung.sayhello.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {
    private var mBinding: ActivityMainBinding? = null
    private val binding get() = mBinding!!

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        mBinding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        var myName = "복학생"
        Log.d("TAG","myname = $myName")
        myName = "졸업생"
        Log.d("TAG","myname = $myName")
        val PI = 3.141592
        Log.d("TAG","pi = $PI")

        var myNumbers = "1,2,3,4,5"
        var myNumbers2 = "1,2,3,43,5"
        if(myNumbers == myNumbers2){
            binding.textSay.setText("당첨되었습니다")

        }else{
            binding.textSay.setText("당첨ㄴㄴ")
        }

        for(idx in 1..10){
            Log.d("TAG","현제 숫자는 ${idx}입니다")

        }


    }
    override fun onDestroy() {
        // onDestroy 에서 binding class 인스턴스 참조를 정리해주어야 한다.
        mBinding = null
        super.onDestroy()
    }}
        var variable = "홍길동"
        var variable2:String
        variable2 = "안녕하세요"
        variable = "다른값"
        // 코틀린의 기본타입
        //실수형
        var doubleValue:Double = 35.6
        //var floatValue:Float = 123.7F
        //정수형
        //var intValue:Int =12345
          var longvalue:Long = 2_300_242
        // var shortValue:Short = 123
        // var byteValue:Byte = 127
        //문자형
        var charValue:Char = 'a'
        var stringValue:String = "string 은 기본형이 아니다"
        //불린형
        var booleanValue:Boolean =true
        //상수
        val VALUE:Boolean = true //상수는 값을 바꾸지 못한다
        var helloWorld = "안녕 세상아!"