![]() So, you can only use a switch to perform an action when one specific variable has a certain precise value. However it cannot replace all sort of if/else sequences but just those which compare a value with some constant. a.z will include all of the characters from a-z and a.Z will include a-z+A-Z. One of the most useful improvement, especially if you come from Java, is the when construct.Ī traditional switch is basically just a statement that can substitute a series of simple if/else that make basic checks. Kotlin also allows this notation for other common ranges, such as characters. Kotlin is full of these pragmatic improvements, getting its user a language that just feel good to use. ![]() There are two kinds of innovation: new perspectives that changes how we look at things and pragmatic improvements that changes how we do things.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |