에러코드
Ambiguous use of 'interestRate'
Invalid redeclaration of 'interestRate'
변수 isOpen의 Bool값은 true입니다.
변수 isLogged의 Bool값은 false입니다.
조건문 isOpen은 값이 true이기 때문이 “문이 열려 있습니다”가 출력됩니다.
함수 CheckLoginStatus는 매개변수가 isLogged입니다.
타입은 Bool이며 값이 false이기 때문에 “로그인되지 않았습니다”가 출력됩니다.
조건문 if (만약) 이 자리에는 Bool값인 true, false만 올수 있다.
Bool값을 사용하는 함수
3)문자
🔨String
문자열을 표현하는 데이터 타입으로 텍스트를 표현할 수 있다.
var emptyString: String = ""
var anotherEmptyString = String()
var variableString = "Lukas"
variableString += " and Steve"
print(variableString)코드를 입력하세요코드를 입력하세요
let horseCharacteres: [Character] = ["H", "o", "r", "s", "e", "!", "🐴"]
let horseString = String(horseCharacteres)
print(horseString)
코드를 입력하세요
let http404Error: (Int, String) = (404, "Not Found")
let (justTheStatusCode, _): (Int, String) = http404Error
print("The status code is \(justTheStatusCode)")
print("The status cod is \(http404Error.0)")
print("The status message is \(http404Error.1)")
let http200Status: (Int, String) = (StatusCode: 200, description: "OK")
let myInfo: (String, Int, Int, Int, String, String) = (name: "Martin", registrationNumber: 960514, height: 175, weight: 72, Job:"DJ", hobby: "Music Producing")코드를 입력하세요
Why❔ 많은 데이터를 담는 데는 적합하지 않는 이유
Because
순서를 알고 있어야 된다는 것이란?
중요!!! 스위프트에서는 첫번째 값에 접근할 떄 1을 사용하는게 아니라 0을 사용합니다.
Zero-based numbering 시작할떄 1이 아닌, 0부터 시작하는 넘버링 방법입니다.
인덱스는 대부분 0부터 시작합니다.
✅Any
var anyArray: [Any] = [1, "Hi", true]
var anyValue: Any = 1000
anyValue = "어떤 타입도 수용 가능"
anyValue = 48292.58
let doubleValue: Double = anyValue
-> Cannot convert value of type 'Any' to specified type 'Double'
Any로 명시된 타입은 더블타입의 값으로 변환할 수 없습니다.