What is out keyword in kotlin

后端 未结 5 1458
情深已故
情深已故 2021-01-30 06:20

I am not able to understand and I couldn\'t find the meaning of out keyword in kotlin.

You can check example here:

List
         


        
5条回答
  •  情深已故
    2021-01-30 06:52

    Remember like this:

    in is "for input" - you wanna put(write) something into it (so it's a "consumer")

    out is "for output" - you wanna take(read) something out of it (so it's a "producer")

    If you're from Java,

    is for input, so it's like (consumer)

    is for output, so it's like (producer)

提交回复
热议问题