diff --git a/Programming Basics/var & val/Exercise 2/src/Task.kt b/Programming Basics/var & val/Exercise 2/src/Task.kt new file mode 100644 index 00000000..a6bb087a --- /dev/null +++ b/Programming Basics/var & val/Exercise 2/src/Task.kt @@ -0,0 +1,7 @@ +fun main() { + var a = 10 + val b = a + a = 42 + println(a) + println(b) +} \ No newline at end of file diff --git a/Programming Basics/var & val/Exercise 2/task-info.yaml b/Programming Basics/var & val/Exercise 2/task-info.yaml new file mode 100644 index 00000000..87aa3599 --- /dev/null +++ b/Programming Basics/var & val/Exercise 2/task-info.yaml @@ -0,0 +1,6 @@ +type: edu +files: +- name: src/Task.kt + visible: true +- name: test/output.txt + visible: false diff --git a/Programming Basics/var & val/Exercise 2/task.md b/Programming Basics/var & val/Exercise 2/task.md new file mode 100644 index 00000000..83df655f --- /dev/null +++ b/Programming Basics/var & val/Exercise 2/task.md @@ -0,0 +1,5 @@ +## `var` & `val` (#2) + +Define `var a = 10`. Now define a `val b = a`. +After that, assign `42` to `a` and display both `a` and `b` +(the output will be in different lines). \ No newline at end of file diff --git a/Programming Basics/var & val/Exercise 2/test/output.txt b/Programming Basics/var & val/Exercise 2/test/output.txt new file mode 100644 index 00000000..cad782b3 --- /dev/null +++ b/Programming Basics/var & val/Exercise 2/test/output.txt @@ -0,0 +1,2 @@ +42 +10 \ No newline at end of file diff --git a/Programming Basics/var & val/lesson-info.yaml b/Programming Basics/var & val/lesson-info.yaml index d243c453..536bd6af 100644 --- a/Programming Basics/var & val/lesson-info.yaml +++ b/Programming Basics/var & val/lesson-info.yaml @@ -1,6 +1,7 @@ content: - Examples - Exercise 1 +- Exercise 2 - Exercise 3 - Exercise 4 - Exercise 5