반응형
import UIKit
//------let과 var
//let 상수 - 변하지 않는 값을 정의
let maxSpeed:Int = 200
//maxSpeed += 10
//var 변수 - 변하는 값을 정의
var currentSpeed:Int = 110 //Int는 생략 가능
currentSpeed += 10
//currentSpped += 20.5 //소수값은 x
//-----String과 Numbers
let name:String = "binbin"
var gretting = "Hello"
gretting += " " + name
//let characters = name.characters//문자에 독립적으로 접근 가능?
//let count = characters.count //몇글자인지
let url = "www.coder.com"
let hasProtocol = url.hasPrefix("http://")
print("\(name)")
currentSpeed += Int(20.5)
let intMax = Int.max //swift에서 표현할 수 있는 정수 중 가장 큰 수
let UintMax = UInt.max //swift에서 표현할 수 있는 양의 정수 중 가장 큰 수
let intMin = Int.min //swift에서 표현할 수 있는 양의 정수 중 가장 큰 수
let UintMin = UInt.min //swift에서 표현할 수 있는 양의 정수 중 가장 작은 수
//타입 변경
let pi = 3.14
let divider = 2
let halfPi = 3.14/Double(divider)
반응형
'애플리케이션 개발 > ios' 카테고리의 다른 글
[Mac] Git 설치 및 연동 (0) | 2022.05.06 |
---|---|
[Mac] M1 자바 버전 11로 변경 (0) | 2022.04.29 |
Could not build Objective-C module 'Firebase' (0) | 2022.01.22 |
M1에서 터미널 사용 (0) | 2022.01.22 |
Xcode Github에 연동 (0) | 2021.01.16 |