Skip to content

Instantly share code, notes, and snippets.

@Fallenstedt
Created December 24, 2019 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fallenstedt/05239094f8f0ed8b278bb3bdc06064c5 to your computer and use it in GitHub Desktop.
Save Fallenstedt/05239094f8f0ed8b278bb3bdc06064c5 to your computer and use it in GitHub Desktop.
import java.util.*
fun main(args: Array<String>) {
dayOfWeek()
}
fun dayOfWeek() {
println("What day is it today?")
val dayOfWeek: Int = Calendar.getInstance().get(Calendar.DAY_OF_WEEK)
val dayLiteral: String = when (dayOfWeek) {
1 -> "Sunday"
2 -> "Monday"
3 -> "Tuesday"
4 -> "Wednesday"
5 -> "Thursday"
6 -> "Friday"
7 -> "Saturday"
else -> "Time has stopped"
}
println("Today is " + dayLiteral)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment