diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/.DS_Store differ diff --git a/NimWorkspace/Anfang b/NimWorkspace/Anfang new file mode 100755 index 0000000..a1ce698 Binary files /dev/null and b/NimWorkspace/Anfang differ diff --git a/NimWorkspace/Anfang.nim b/NimWorkspace/Anfang.nim new file mode 100644 index 0000000..8f72421 --- /dev/null +++ b/NimWorkspace/Anfang.nim @@ -0,0 +1,5 @@ +var x,y,z :int +x = 10 +y = 25 +z = x + y +echo "sum of ", x, " and ", y, " is ", z \ No newline at end of file diff --git a/NimWorkspace/Prozeduren b/NimWorkspace/Prozeduren new file mode 100755 index 0000000..62ed02b Binary files /dev/null and b/NimWorkspace/Prozeduren differ diff --git a/NimWorkspace/Prozeduren.nim b/NimWorkspace/Prozeduren.nim new file mode 100644 index 0000000..cec0031 --- /dev/null +++ b/NimWorkspace/Prozeduren.nim @@ -0,0 +1,37 @@ +proc plus(x, y: int): int = x + y +proc multi(x, y: int): int = x * y + +let a = 2 +let b = 3 +let c = 4 + +echo a.plus(b) == plus(a, b) # True +echo c.multi(a) == multi(c, a) # True + +# Verketteter Aufruf +echo a.plus(b).multi(c) # (2 + 3) * 4 = 20 + +# Alternativ +echo multi((a.plus(b)), c) # (2 + 3) * 4 = 20 + + +proc findBiggest(a: seq[int]): int = + # result = 0 + for number in a: + if number > result: + result = number + # Ende der proc + +let d = @[3, -5, 11, 33, 7, -15] +echo findBiggest(d) + +proc toString(x: int): string = + result = if x < 0: "negativ" + elif x > 0: "positiv" + else: "Null" + +proc toString(x: bool): string = + result = if x: "ja" else: " ein" + +echo toString(13) # "positiv" +echo toString(true) # "ja" \ No newline at end of file diff --git a/NimWorkspace/hello b/NimWorkspace/hello new file mode 100755 index 0000000..02e44e5 Binary files /dev/null and b/NimWorkspace/hello differ diff --git a/NimWorkspace/hello.nim b/NimWorkspace/hello.nim new file mode 100644 index 0000000..9273146 --- /dev/null +++ b/NimWorkspace/hello.nim @@ -0,0 +1 @@ +echo "Hallo Welt" \ No newline at end of file diff --git a/Nim_praesentation-6.pptx b/skript/Nim_praesentation-6.pptx similarity index 100% rename from Nim_praesentation-6.pptx rename to skript/Nim_praesentation-6.pptx diff --git a/~$Nim_praesentation.pptx b/~$Nim_praesentation.pptx new file mode 100644 index 0000000..9b71689 Binary files /dev/null and b/~$Nim_praesentation.pptx differ