package com.zj.example.kotlin.basicsknowledge

/**
 * Created by zhengjiong
 * date: 2017/9/10 17:28
 */

val range1: IntRange = 1..100   //[1,100]
var range2: IntRange = 1 until 100 //[1, 99)

var range3: IntRange = 1..-1 //null

fun main(args: Array<String>) {
    println(range1.contains(1))//true
    println(1 in range2)//true

    println(range3.isEmpty())//true
    println(range3 == null)//false, range3是empty而不是null
    println(range3)//1..-1
    for (i in range3) {
        //因为range3是empty, 所以不会进入for循环
        println(i)
    }
}