

Variables, Data Types, Immutability and User Input with Kotlin - Marcus Eisele -...
source link: https://marcuseisele.com/pages/learningkotlin/variables/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Variables, Data Types, Immutability and User Input with Kotlin
Hi and welcome to our second coding lesson.
In this lesson we will learn about Variables, Data Types, Immutability, and how to get User Input into our Application.
Here is the video to follow along:
Video
References:
URLs:
Code:
fun main() {
println("Hello Variables!")
//Values are only assignable once, Variables can be re-assigned
//Variables and DataTypes
//different types in Kotlin
//https://kotlinlang.org/docs/reference/basic-types.html
//Numbers
val myNumber = 12
val myLongNumber = 12L
//Floating Numbers
val myFloatingDouble = 12.34
val myFloat = 12.34f
val divisionResult = 6/4 //will store a 1
val divisionResultDouble = 6/4.toDouble() //will store 1.5
//Text
val myCharacter = 'M'
val myString = "My Name is Marcus"
//Boolean (True or False), think about it as yes or no
val willWeLearnKotlin = true
val firstName = "Marcus"
val lastName = "Eisele"
var myAgeYears = 33
println("Hello $firstName $lastName! You are $myAgeYears years old. You will learn Kotlin today: $willWeLearnKotlin")
myAgeYears = 34
println("Hello $firstName! Happy Birthday! You are now $myAgeYears old")
println("Hey you! Please insert your own name:")
val ownName = readLine()
println("Hi $ownName!")
}
If you have any further questions, leave a comment either here on the Blog, on the Youtube-Video or join the Discord Community.
</div
Recommend
-
20
您的连接不是私密连接 攻击者可能会试图从 typealias.com 窃取您的信息(例如:密码、通讯内容或信用卡信息)。了解详情
-
10
This is the second part in a series about introducing the Rust language to JavaScript developers. Here’s the previous chapter:
-
9
Translate this pageOther languages: ...
-
11
An Introductory Guide to Variables and Data Types in GoJanuary 5th 2021 new story
-
8
Messaging Immutability in Message Types Jimmy Bogard...
-
6
Segmentation failure when using scanf with 3 input variables advertisements Not sure why I'm getting a segmentation fault here:
-
11
Variables, Basic Types, and Arraysby Chike Mgbemena Aug 11, 2017(Updated Apr 11, 2022)Read Time:12 minsLanguages:
-
8
JEP 429: Extent-Local Variables to Promote Immutability in Java Sep 09, 2022...
-
13
JavaScript from Beginner to Master Tutorial Series (3 Part Series) ...
-
8
1. Introduction: *JavaScript * is a versatile and powerful programming language that plays a vital role in web development. It empowers developers to create interactive and dynamic web applications on both the frontend an...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK