[Grammer] 05 - Variables and Constants

in swift4 •  6 years ago 
  • Variables(변수) : Keyword, Identifier, Type, Initial Value 등을 이용함.
var variableName = initialValue
var name = "James"
var year = 2017
var swiftVersion = 4.0
var isMale = true
  • Constants(상수) : 값을 변경 할 수 없음.
let variableName = initialValue
let name = "James"
let year = 2017
let swiftVersion = 4.0
let isMale = true
// year = 2019 << ERROR
  • Type Annotation: 자료형을 직접 지정하는 것
// var variableName: typeName
var name: String
name = "Geonhwi"
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!