From aad6cdbeb81381558c5dc6356e9a40af7a0d0503 Mon Sep 17 00:00:00 2001 From: Ileyan <3003916@stud.hs-mannheim.de> Date: Fri, 7 Jun 2024 22:07:16 +0200 Subject: [PATCH] Create recap.groovy --- live/solutions/recap.groovy | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 live/solutions/recap.groovy diff --git a/live/solutions/recap.groovy b/live/solutions/recap.groovy new file mode 100644 index 0000000..9436545 --- /dev/null +++ b/live/solutions/recap.groovy @@ -0,0 +1,20 @@ +class Person{ + def name + def age + + def toString() { + "${name}, Alter: ${age}" + } +} +def personen = [new Person(name: "Alice", age: 20), +new Person(name: "Bob", age: 18), +new Person(name: "Charlie", age: 30), +new Person(name: "David", age: 15), +new Person(name: "Eve", age: 21)] + +personen.each{println it} +def sum = 0 +for (i in 1..10) { + sum += i +} +println("Summe der Zahlen von 1-10: ${sum}") \ No newline at end of file