Kotlin removeメソッドでmutableSetの値を削除する

環境
Windows10 Home 64bit
Java 19.0.1
Kotlin 1.7.20-release-201

書式
val 変数名 =mutableSetOf(要素1,要素2,…
変数名.remove(値)
removeメソッドを使ってmutableSetの値を削除します。

使用例

fun main() {
       val cft = mutableSetOf( "study", "skill", "become", "smart", "arkgame" )

    println( cft )

    cft.remove("arkgame")

    println( cft ) 

    cft.remove("smart")

    println( cft ) 
}

実行結果
[study, skill, become, smart, arkgame]
[study, skill, become, smart]
[study, skill, become]

Kotlin

Posted by arkgame