Private val isOpen = false.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Private val isOpen = false..

Why we use this? Or what is the purpose of this in Kotlin ? Anyone know.please tell me ASAP. Waiting.

8th Jun 2020, 6:50 PM
Huba Khan
Huba Khan - avatar
9 Answers
0
This is looking like as a Boolean is declared to check the status whether it is open or not.
8th Jun 2020, 6:51 PM
Hardik Sharma
Hardik Sharma - avatar
+ 3
It is similar to status of something that is not going to change. It is because 'val' variables are immutable. So isOpen will remain false throughout the code.
8th Jun 2020, 6:58 PM
Avinesh
Avinesh - avatar
0
It is use in RecyclerViewAdapter. Still it means the same?
8th Jun 2020, 6:53 PM
Huba Khan
Huba Khan - avatar
0
As I do not have the complete code, all I can say by just analysing the coding style and I think it is checking whether something has been opened or not.
8th Jun 2020, 6:55 PM
Hardik Sharma
Hardik Sharma - avatar
0
Thank you. ✌
8th Jun 2020, 6:58 PM
Huba Khan
Huba Khan - avatar
0
You're welcome
8th Jun 2020, 6:58 PM
Hardik Sharma
Hardik Sharma - avatar
0
Its var* sorry typing mistake.
8th Jun 2020, 6:59 PM
Huba Khan
Huba Khan - avatar
0
So it must be as I have suggested above or share your code for specific answer.
8th Jun 2020, 7:12 PM
Hardik Sharma
Hardik Sharma - avatar
0
I got it. Thank u
8th Jun 2020, 7:34 PM
Huba Khan
Huba Khan - avatar