• SubType of any other Types (extends all other types)
• In opposite, Any is Super class of any other class (World without Null) (World with Null) Image Reference: https://medium.com/@m.sandovalcalvo/kotlin-type-system-unveiling-the-mystery-50613f0db893
Use case • Adding Nothing, IDE will know the println is unreachable This look correct, but actually this line will never run (Video example is uploaded here: https://youtu.be/fjECMd1H-hI)
Use case 2: Exception • After throw Exception, program will end • It is more accurate to use “Nothing” as return type to indicate it never return Assume we would Load some data from Database,
and throw Exception if it return null (Video example is uploaded here: https://youtu.be/HG210SN4_iI)
Why we need a class that is Sub Type of any other classes? Bottom Type Image Reference: https://medium.com/@m.sandovalcalvo/kotlin-type-system-unveiling-the-mystery-50613f0db893
2. Usage in Generic • Example: A Linked List implementation LinkedList Example Reference: https://www.codementor.io/@kotlin_academy/kotlin-s-nothing-its-usefulness-in-generics-j4wcu5taa