refactor: variables/short declaration exercises and questions

This commit is contained in:
Inanc Gumus
2018-10-22 22:20:09 +03:00
parent 411be187ab
commit 27689aad9f
14 changed files with 42 additions and 20 deletions

View File

@ -8,9 +8,10 @@
package main
// ---------------------------------------------------------
// EXERCISE
// Declare and then print four variables
// using the short declaration statement
// EXERCISE: Short Declare
//
// Declare and then print four variables using
// the short declaration statement.
//
// EXPECTED OUTPUT
// i: 314 f: 3.14 s: Hello b: true

View File

@ -8,7 +8,8 @@
package main
// ---------------------------------------------------------
// EXERCISE
// EXERCISE: Multiple Short Declare
//
// Declare two variables using multiple short declaration
//
// EXPECTED OUTPUT

View File

@ -8,11 +8,12 @@
package main
// ---------------------------------------------------------
// EXERCISE
// 1- Declare two variables using short declaration
// EXERCISE: Multiple Short Declare #2
//
// 2- `a` variable's value should be 42
// 3- `c` variable's value should be "good"
// 1. Declare two variables using short declaration
//
// 2. `a` variable's value should be 42
// 3. `c` variable's value should be "good"
//
// EXPECTED OUTPUT
// 42 good

View File

@ -8,9 +8,11 @@
package main
// ---------------------------------------------------------
// EXERCISE
// 1- Short declare a variable named `sum`
// 2- Initialize it with an expression by adding 27 and 3.5
// EXERCISE: Short With Expression
//
// 1. Short declare a variable named `sum`
//
// 2. Initialize it with an expression by adding 27 and 3.5
//
// EXPECTED OUTPUT
// 30.5

View File

@ -8,17 +8,18 @@
package main
// ---------------------------------------------------------
// EXERCISE
// 1- Short declare two bool variables
// EXERCISE: Short Discard
//
// 1. Short declare two bool variables
// (use multiple short declaration syntax)
//
// 2- Initialize both variables to true
// 2. Initialize both variables to true
//
// 3- Change your declaration and
// 3. Change your declaration and
// discard the 2nd variable's value
// using the blank-identifier
//
// 4- Print only the 1st variable
// 4. Print only the 1st variable
//
// EXPECTED OUTPUT
// true

View File

@ -8,16 +8,17 @@
package main
// ---------------------------------------------------------
// EXERCISE
// 1- Short declare two int variables: age and yourAge
// EXERCISE: Redeclare
//
// 1. Short declare two int variables: age and yourAge
// (use multiple short declaration syntax)
//
// 2- Short declare a new float variable: ratio
// 2. Short declare a new float variable: ratio
// And, change the 'age' variable to 42
//
// (! You should use redeclaration)
//
// 4- Print all the variables
// 4. Print all the variables
//
// EXPECTED OUTPUT
// 42, 20, 3.14

View File

@ -0,0 +1,15 @@
# Short Declare
Time to declare a few variables using the short declaration syntax. You'll also use the redeclaration and discarding.
1. **[Short Declare](https://github.com/inancgumus/learngo/tree/master/06-variables/03-short-declaration/exercises/01-short-declare)**
2. **[Multiple Short Declare](https://github.com/inancgumus/learngo/tree/master/06-variables/03-short-declaration/exercises/02-multiple-short-declare)**
3. **[Multiple Short Declare #2](https://github.com/inancgumus/learngo/tree/master/06-variables/03-short-declaration/exercises/03-multiple-short-declare-2)**
4. **[Short With Expression](https://github.com/inancgumus/learngo/tree/master/06-variables/03-short-declaration/exercises/04-short-with-expression)**
5. **[Short Discard](https://github.com/inancgumus/learngo/tree/master/06-variables/03-short-declaration/exercises/05-short-discard)**
6. **[Redeclare](https://github.com/inancgumus/learngo/tree/master/06-variables/03-short-declaration/exercises/06-redeclare)**