CODEX -1 BASIC INTRODUCTION SWIFT

Swift Language

Swift Language

 

  • Swift Language enhanced the programming features.
  • Fast in Programming.
  • Easy and understable Language.
  • Vast amount of plugins which makes easier to developer to code.
  • Less coding and great Output.
  • Lets we see some basic of swift language .

VARIABLE AND CONSTANT

1 . VARIABLE

  • var testVar = “Hello,Friend”
  • print(testVar)
  • Above statement prints -> Hello,Friend
  • Here, var -> variable.
  •             testVar -> variable name.
  • print is used for variable to print in console -> print(test)
  • var can be changeable any time.

 2. CONSTANT  

  • let testCon = “Hello,Friend”
  • print(testCon)
  •  Above statement prints -> Hello,Friend
  • Here,let  ->   Used for declaration of constant variable
  •           testCon -> It’s stands for constant variable name.
  • print is used for constant to print in console -> print(testCon)
  • let once is declare it’s not change;

3. DIFFERENCE BETWEEN VARIABLE AND CONSTANT

  • Variable -> var  is changeable
  • Example var country = “India”
  •                    country = “My India”
  • So, variable change the value to “India” – > “My India”
  • It’s print(country)
  • Output : My India
  •  Constant -> let is not changeable
  • Example let country = “India”
  •                    country = “My India”
  • So, Constant not change the value and remain first declare value -> India
  • it’s print(country)
  • Output : India.`

 

Leave a Reply

Your email address will not be published. Required fields are marked *