Last active
January 9, 2023 15:05
-
-
Save aqua30/d592a25e8f382e69e4cda48495a0b013 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainViewModel: ViewModel() { | |
private var creditScore = mutableStateOf(0) | |
private var age = mutableStateOf(18) | |
val isEligible = derivedStateOf { | |
creditScore > 400 && age > 18 && age < 70 | |
} | |
fun creditScore(score: Int) { | |
creditScore.value = score | |
} | |
fun age(age: Int) { | |
this.age.value = age | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment