본문 바로가기 메뉴 바로가기

취미코딩

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

취미코딩

검색하기 폼
  • 분류 전체보기 (101)
    • Kotlin (25)
    • JAVA (25)
    • HTML, CSS (13)
    • Javascript, jQuery (10)
    • Linux (2)
    • Windows (3)
    • MAC (16)
    • IT (7)
  • 방명록

switch문 (2)
코틀린 기초 문법) 5. 코틀린 조건식 if, when, switch 문 사용하기

if문은 자바와 동일합니다. 자바에서는 switch문 코틀린에서는 when문을 이용합니다. fun main(args: Array) { println(compareNum(1, 2)) println(compareNum2(1, 2)) println("=============") println(strNum(null)) println(strNum(1)) println(strNum(2)) println(strNum(3)) println(strNum2(null)) println(strNum2(1)) println(strNum2(2)) println(strNum2(3)) } // if문 fun compareNum(x: Int, y: Int): Int { if (x > y) return x else return y } ..

Kotlin 2019. 5. 19. 20:03
(JAVA) 자바 조건문(if,switch)과 반복문(for,while,do while) break, continue간단히 끝내버리기~

조건문if문조건식에 해당되면 실행문이 실행되고 아니면 실행하지 않는다. public class test1{ public static void main(String[] args){ int num = 10; if(num>5){ //조건식 num>5 System.out.println("5보다 크다"); //실행문 } if - else 문 조걱식에 해당되면 if문 블록이 실행되고 조건식에 해당하지 않으면 else 블록이 실행된다. public class test1{ public static void main(String[] args){ int num = 10; if(num>5){ //조건식 num>5 System.out.println("5보다 크다"); //실행문 }else{ System.out.println(..

JAVA 2016. 11. 22. 22:11
이전 1 다음
이전 다음
최근에 올라온 글
최근에 달린 댓글

Blog is powered by Tistory / Designed by Tistory

티스토리툴바