how can I flip a boolean state in a given interval...
# announcements
f
how can I flip a boolean state in a given interval (every 2 min)?
d
You can even just calculate the Boolean state based on time.
r
Genius! I love the simplicity of that.
fun booleanState(tickInterval: java.time.Duration = java.time.Duration.ofMinutes(2)) = ((System.currentTimeMillis() / tickInterval.toMillis()) % 2) == 0L
❤️ 1