In fact, let’s compare the two! Similarities between Libby's handwritten list and the Kotlin list. This code looks pretty similar to Libby’s handwritten list. Val book5 = "The Kingsford Manor Mystery"Ĭreating a list of strings to represent titles of books. Here’s what she wrote: val book1 = "Tea with Agatha" Libby has been learning to write Kotlin code in her spare time, so she also wanted to write this same list in Kotlin, and print all of the titles to the screen. The Kingsford Manor Mystery Tea with Agatha Mystery on First Avenue The Ravine of Sorrows Among the Aliens Books to Read Here are the titles that are currently on her list: A sheet of paper with a list of books that Libby wants to read. She’s always on the lookout for a great novel, so whenever someone tells her about a good book, she jots down the title on a list that she keeps on a sheet of paper. To learn about collections, let’s visit Libby, a bright young lady who’s always got a book nearby! Who Loves to Read Books? Writing Kotlin becomes so much more interesting once we start putting variables together in a way that we can work on them as a collection. So far, we’ve only worked with variables as individual values.
0 Comments
Leave a Reply. |