From 2da65943ef6586c78196bb4725c1252cf3acb9be Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Wed, 9 Oct 2019 10:42:09 +0200 Subject: [PATCH] Added a new task for 'var & val' --- Programming Basics/var & val/Exercise 2/src/Task.kt | 7 +++++++ Programming Basics/var & val/Exercise 2/task-info.yaml | 6 ++++++ Programming Basics/var & val/Exercise 2/task.md | 5 +++++ Programming Basics/var & val/Exercise 2/test/output.txt | 2 ++ Programming Basics/var & val/lesson-info.yaml | 1 + 5 files changed, 21 insertions(+) create mode 100644 Programming Basics/var & val/Exercise 2/src/Task.kt create mode 100644 Programming Basics/var & val/Exercise 2/task-info.yaml create mode 100644 Programming Basics/var & val/Exercise 2/task.md create mode 100644 Programming Basics/var & val/Exercise 2/test/output.txt 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