refactor: variables/short declaration exercises and questions
This commit is contained in:
@ -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
|
@ -8,7 +8,8 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE
|
||||
// EXERCISE: Multiple Short Declare
|
||||
//
|
||||
// Declare two variables using multiple short declaration
|
||||
//
|
||||
// EXPECTED OUTPUT
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
15
06-variables/03-short-declaration/exercises/README.md
Normal file
15
06-variables/03-short-declaration/exercises/README.md
Normal 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)**
|
Reference in New Issue
Block a user