Javascript – Data types and numbers

Javascript – Data types and numbers

Javascript has primitive types and objects primitive types: number 1, 5, 66 string ‘Hello’ “World” boolean true false null undefined objects: anything else than primitive types Remember that Javascript is a weakly typed language and you cannot declare the type of the variable. You can use the typeof operator to the find the type of a variable. numbers The numbers can be: integer 10, 6, 536363 signed integer -22 decimal 2.3 , -300.12 scientific notation 1e1, 2e+3 octal 017 hexadecimal 0xF1 NaN not a number Number operators Javascript has binary…

Javascript – Data types and numbers Read More

Java – Variables and Types

Java – Variables and Types

Variable is a small piece of memory that holds information/data value. All variables have data types. Types define the type of information, a category or set of data values. Also defines the operations that can be performed on the data. Variable must also have a name. It is an identifier and can contain letters, numbers and underscore (_). It cannot start with a digit. Names are case sensitive, that means that name is different from NAME. There is no length limit and should not use Java reserved words. Some tips:…

Java – Variables and Types Read More

Kotlin – Safe-call operator for Nullable types and let

Screenshot 20190113 130030

Safe-call operator is an operator that Kotlin implemented so we can handle the Nullable types. In Kotlin if a variable is nullable then you need to check if is null or not so you can access its properties. Safe-call operator (?.) returns the a value if not null otherwise it returns null. So we can rewrite the above code: You can also perform a specific operation when there is a non-null value using let THE END!!! Kotlin – Nullable and not-null types Kotlin – Functions Part 2 Kotlin – Functions…

Kotlin – Safe-call operator for Nullable types and let Read More

Kotlin – Nullable and not-null types

Screenshot 20190112 121335

A huge problem in Java is when you get NullPointerException. You get this exception when you try to access a member of a null reference. This problem is known as The Billion Dollar Mistake. Kotlin fixed this issue by not allowing the variable to be null. So by default, all the variable in Kotlin cannot be null. They are all non-null types. If you want one variable to be null then you must use ? after the type. If you want access a property of a nullable variable the compiler…

Kotlin – Nullable and not-null types Read More