swfit

    Swift: 기초문법 ( if / switch ) , ( for / while ) 조건문과 반복문 제어문(3)

    Swift: 기초문법 ( if / switch ) , ( for / while ) 조건문과 반복문 제어문(3)

    안녕하세요! kyuu 입니다 :) 오늘은 Swift에 조건문과 반복문에 대해 알아보도록 합시다! 본 게시글은 devxoul 님과 seons 님 게시글을 참고하여 작성되었습니다. 조건문 ( if , switch ) swift에서 조건을 검사할 때는 if , switch 를 사용합니다 자 먼저 if 먼저 사용한 예시를 보여드릴게요! var age = 19 var student = "" if age >= 8 && age < 14 { student = "초등학생" } else if age < 17 { student = "중학생" } else if age < 20 { student = "고등학생" } else { student = "기타" } student // 고등학생 if 문의 조건절에는 값이 정확하게 참 혹..