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 package main
// --------------------------------------------------------- // ---------------------------------------------------------
// EXERCISE // EXERCISE: Short Declare
// Declare and then print four variables //
// using the short declaration statement // Declare and then print four variables using
// the short declaration statement.
// //
// EXPECTED OUTPUT // EXPECTED OUTPUT
// i: 314 f: 3.14 s: Hello b: true // i: 314 f: 3.14 s: Hello b: true

View File

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

View File

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

View File

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

View File

@ -8,17 +8,18 @@
package main package main
// --------------------------------------------------------- // ---------------------------------------------------------
// EXERCISE // EXERCISE: Short Discard
// 1- Short declare two bool variables //
// 1. Short declare two bool variables
// (use multiple short declaration syntax) // (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 // discard the 2nd variable's value
// using the blank-identifier // using the blank-identifier
// //
// 4- Print only the 1st variable // 4. Print only the 1st variable
// //
// EXPECTED OUTPUT // EXPECTED OUTPUT
// true // true

View File

@ -8,16 +8,17 @@
package main package main
// --------------------------------------------------------- // ---------------------------------------------------------
// EXERCISE // EXERCISE: Redeclare
// 1- Short declare two int variables: age and yourAge //
// 1. Short declare two int variables: age and yourAge
// (use multiple short declaration syntax) // (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 // And, change the 'age' variable to 42
// //
// (! You should use redeclaration) // (! You should use redeclaration)
// //
// 4- Print all the variables // 4. Print all the variables
// //
// EXPECTED OUTPUT // EXPECTED OUTPUT
// 42, 20, 3.14 // 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)**