Compare commits

...

2 Commits

Author SHA1 Message Date
p1ng0ut b6463aa249 Add variable declaration slides 2023-01-22 21:17:55 +01:00
p1ng0ut 0f8dbac1bc Add some slides to the basic chapter 2023-01-22 21:17:55 +01:00
2 changed files with 84 additions and 13 deletions

View File

@ -21,19 +21,21 @@ export PATH=<path_to_reval_md_bin_path>:$PATH
or by adding this path to `~/.profile`. When this is done, you can execute the command:
```shell
reveal-md docs/index.md
reveal-md docs/index.md -w
```
## Kotlin Native Build
To compile this project natively, you have to go to the [current Kotlin release page](https://github.com/JetBrains/kotlin/releases) (currently
version 1.8.0) and download the distribution
that fits your operating system (you have to scroll down a bit). and download the
distribution that fits your operating system (you have to scroll down a bit).
To compile this project natively, you have to go to
the [current Kotlin release page](https://github.com/JetBrains/kotlin/releases) (currently
version 1.8.0) and download the distribution that fits your operating system (you have to scroll
down a bit).
```shell
kotlinc-native src/nativeMain/kotlin/Main.kt -o build/Main
```
[^1]: A tutorial for the installation can be found at
the [link](https://nodejs.org/en/download/package-manager/) above.

View File

@ -1,19 +1,88 @@
---
title: Dezentrale Kotlin Course
separator: <!--s-->
verticalSeparator: <!--v-->
separator: <!--next_chapter-->
verticalSeparator: <!--next_slide-->
theme: night
revealOptions:
transition: 'fade'
---
# Kotlin Course
# Kotlinkurs
---
<!--next_chapter-->
## Kotlin Language Basics
## Kotlin die Multiplattform-Sprache
Kotlin is a...
- **JVM**: Java-Code kann in Kotlin eingebunden werden und umgekehrt
- **Android**: Ausführung auf verschiedenen Geräten
- **JS**: Client-Anwendungen lauffähig im Browser
- **Native**: Kompilieren für jedes Betriebssystem (bspw. Windows, Linux, iOS und macOS)
- multiplatform programming language
-
<!--next_slide-->
## Mehrere Programmierparadigmen möglich
- _imperative_ Programmierung,
- _objektorientierte_ Programmierung,
- _generische_ Programmierung,
- _funktionale_ Programmierung und mehr.
<!--next_slide-->
## Etwas Geschichte
- Kotlin wurde **2011** erstmals vorgestellt und
- seit **2010** entwickelt
- **2016** wurde Version 1.0 veröffentlicht
- **2017** auf Google I/O erstklassiger Support angekündigt
<!--next_chapter-->
## Ein Beispielprogramm
Hello-World, wie üblich (siehe [Main.kt](../src/nativeMain/kotlin/Main.kt)):
```kotlin
fun main() {
println("Hello, Kotlin/Native!")
}
```
<!--next_slide-->
## Grundlegende Begriffe (1/2)
- Ein **Programm** ist eine Folge von Anweisungen, die nacheinander ausgeführt werden.
- Eine **Anweisung** ist ein einzelner auszuführender Befehl (drucke den Text),
- Ein **Ausdruck** ist ein Codestück, das einen einzigen Wert ergibt (z. B. ist 2*2 ein Ausdruck)
<!--next_slide-->
## Grundlegende Begriffe (2/2)
- Ein **Block** ist eine Gruppe von Anweisungen, in einem Paar geschweifter Klammern `{...}`
- Des Weiteren gibt es noch:
- **Schlüsselwörter** - Wort mit besonderer Bedeutung in der Programmiersprache
- **Bezeichner** - Wort um etwas zu identifizieren
- **Kommentare** - Text der beim Ausführen des Programms identifiziert wird
<!--next_slide-->
## Variablen deklarieren
- **val** (für value) deklariert unveränderliche Variable
- **var** (für Variable) deklariert eine veränderbare Variable
Der anschließende, zwingend erforderliche Name darf nicht mit einer Zahl beginnen!
<!--next_slide-->
### Beispiel:
```kotlin
val language = "Kotlin"
```
Achtung: Variablennamen sind case-sensitiv:
language != Language