kotlin create optional variable code example
Example: kotlin optional parameter
fun View.fadeOut(duration: Long = 500): ViewPropertyAnimator {
return animate()
.alpha(0.0f)
.setDuration(duration)
}
icon.fadeOut() // fade out with default time (500)
icon.fadeOut(1000) // fade out with custom time