CODEX – 2 CONCATENATE SWIFT

VARIABLE AND CONSTANT

  • var testVar1 = “Hello,”
  • var testVar2 = “Friend”
  • var testAll = testVar1 + testVar2
  • Above is used when both in string form.
  • print(testAll)
  • Output : Hello,Friend

 

  • let testVar1 = “Rank”
  • let testVar2 = “1”
  • let testAll =  testVar1 + string(testVar2)
  • We declare string before string in second let because it integer.Its convert into string.
  • print(testAll)

Leave a Reply

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