Classes (Part I)

Classes are the core of Object-oriented programming (OOP). The most common analogy out there is that a class is like a blueprint. It will give you the structure or the details about something and you can then use this blueprint to build things. I guess another analogy that works would be that a class isContinue reading “Classes (Part I)”

Scope Functions

The Merriam-Webster dictionary defines the word scope as: 1: INTENTION, OBJECT2: space or opportunity for unhampered motion, activity, or thought3: the extent of treatment, activity, or influence4: range of operation This makes a lot of sense when we refer to scope in programming. The scope of a variable is the “area” where that variable canContinue reading “Scope Functions”

Collections

According to the Oxford dictionary, a collection is, in the simplest definition I have ever seen, a group of things or people. But, to be honest, there’s no reason to complicate this. You can have a collection of stamps, rare coins, some people collect beer bottle caps, some people collect Funko Pops, some people collectContinue reading “Collections”

A Brave New World of Functions (λ)

In a previous post, I wrote about Kotlin Functions and, amongst other things, how they can be defined, named and then used by calling the function’s name. However, this is not the only way to define a function. When you call a function like println() , readLine(), etc you are calling regular named functions. TheyContinue reading “A Brave New World of Functions (λ)”

Exceptions in Kotlin

Just like several other languages, Kotlin includes exceptions to indicate something went wrong in your application. Here we saw the NumberFormatException when we tried to convert a String that had stored a Double into an Int. Another well-known exception is the NullPointerException which occurs when a variable is accessed and it’s not pointing to anyContinue reading “Exceptions in Kotlin”

More on Null Safety

In my previous post about null safety, I wrote a bit about what it is and why it is such a good thing that Kotlin has a clever way to deal with that by verifying all your assignments to make sure you don’t accidentally assign null values to variables that are not marked as nullable.Continue reading “More on Null Safety”

Strings in Kotlin

In programming languages, a string is a data type that holds characters (textual data) or, basically, text. It can be formed by a sequence of letters, digits, punctuation, and other valid characters. The most famous string ever in the programming land is the “Hello World”. In Kotlin, strings are placed within double quotes “…”. SoContinue reading “Strings in Kotlin”

Numbers in Kotlin

As I mentioned here, Kotlin has different data types you can use to store information. In this post, I will focus on the ones used to hold numbers, since there are different ways to store both whole numbers and decimals depending on how much data you need the variable to hold. In Kotlin, regardless ofContinue reading “Numbers in Kotlin”

Kotlin Functions

A function is a reusable portion of code that will perform a specific task. They encapsulate one or more tasks and can be reused throughout the code avoiding repetition. Kotlin (and other languages) provide a myriad of functions that help us write code like the println() function, for example, that will print things to theContinue reading “Kotlin Functions”

Compile Time vs Run-time Errors

Before we start talking about compile-time errors vs Run-time errors let’s get an overview of what Compile means. When we (humans) write a code to create a program we do it in human-understandable languages called high-level languages. They use English words and have a syntax that our brains can read and understand. Some examples ofContinue reading “Compile Time vs Run-time Errors”