fix: questions typos of the if statement section
This commit is contained in:
@ -3,10 +3,10 @@
|
|||||||
2. `!=`
|
2. `!=`
|
||||||
3. `>` *CORRECT*
|
3. `>` *CORRECT*
|
||||||
|
|
||||||
> **3:** That's the greater operator. It checks whether a ordered value is greater than the other or not.
|
> **3:** That's the greater operator. It checks whether an ordered value is greater than the other or not.
|
||||||
|
|
||||||
|
|
||||||
## Which one below is not one of the comparison operators of Go?
|
## Which one below is not one of the ordering operators of Go?
|
||||||
1. `>`
|
1. `>`
|
||||||
2. `<=`
|
2. `<=`
|
||||||
3. `==` *CORRECT*
|
3. `==` *CORRECT*
|
||||||
@ -24,7 +24,7 @@
|
|||||||
> **3:** That's right. All the comparison operators return an untyped bool value (true or false).
|
> **3:** That's right. All the comparison operators return an untyped bool value (true or false).
|
||||||
|
|
||||||
|
|
||||||
## Which one of these cannot be used as an operand to ordering operators (`>`, `<`, `>=`, `<=`)?
|
## Which one of these below cannot be used as an operand to ordering operators (`>`, `<`, `>=`, `<=`)?
|
||||||
1. int value
|
1. int value
|
||||||
2. byte value
|
2. byte value
|
||||||
3. string value
|
3. string value
|
||||||
|
@ -117,7 +117,7 @@ func main() {
|
|||||||
|
|
||||||
// Don't mind about these functions.
|
// Don't mind about these functions.
|
||||||
// Just focus on the problem.
|
// Just focus on the problem.
|
||||||
// These are here just for you to understand it better.
|
// They are here just for you to understand what's going on better.
|
||||||
func super() bool {
|
func super() bool {
|
||||||
fmt.Print("super ")
|
fmt.Print("super ")
|
||||||
return true
|
return true
|
||||||
|
@ -79,7 +79,7 @@ func main() {
|
|||||||
>
|
>
|
||||||
> **3:** Perfect! You don't need to compare the value to `true`. `happy` is already true, so it'll print "cool!".
|
> **3:** Perfect! You don't need to compare the value to `true`. `happy` is already true, so it'll print "cool!".
|
||||||
>
|
>
|
||||||
> **4:** That won't print anything. `happy` will be true.
|
> **4:** That won't print anything. `!happy` yields false.
|
||||||
|
|
||||||
|
|
||||||
## How can you simplify the following code? You only need to change the condition expression, but how?
|
## How can you simplify the following code? You only need to change the condition expression, but how?
|
||||||
@ -108,7 +108,7 @@ func main() {
|
|||||||
> **4:** That won't print anything. `happy` will be true.
|
> **4:** That won't print anything. `happy` will be true.
|
||||||
|
|
||||||
|
|
||||||
## Is this code going to work? Why?
|
## This code contains an error. How to fix it?
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
## Why error handling is needed?
|
||||||
|
1. I don't know.
|
||||||
|
2. To control the execution flow.
|
||||||
|
3. To make a program malware safe.
|
||||||
|
4. Because, things can go wrong. *CORRECT*
|
||||||
|
|
||||||
|
> **1:** Then, please watch the lecture again! :)
|
||||||
|
>
|
||||||
|
> **2:** Actually yes, but that's not the main reason.
|
||||||
|
>
|
||||||
|
> **3:** Come on!
|
||||||
|
|
||||||
|
|
||||||
## What's a nil value?
|
## What's a nil value?
|
||||||
1. The dark matter that rules the universe.
|
1. The dark matter that rules the universe.
|
||||||
2. It's a zero value for pointers or pointer-based types. It means the value is uninitialized. *CORRECT*
|
2. It's a zero value for pointers or pointer-based types. It means the value is uninitialized. *CORRECT*
|
||||||
@ -13,25 +26,12 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
|
|
||||||
## Why error handling is needed?
|
|
||||||
1. I don't know.
|
|
||||||
2. To control the execution flow.
|
|
||||||
3. To make a program malware safe.
|
|
||||||
4. Because, things can go wrong. *CORRECT*
|
|
||||||
|
|
||||||
> **1:** Then, please rewatch the lecture! :)
|
|
||||||
>
|
|
||||||
> **2:** Actually yes, but that's not the main reason.
|
|
||||||
>
|
|
||||||
> **3:** Come on!
|
|
||||||
|
|
||||||
|
|
||||||
## How Go handles error handling?
|
## How Go handles error handling?
|
||||||
1. Using a throw/catch block
|
1. Using a throw/catch statement
|
||||||
2. Using a simple if statement with nil comparison *CORRECT*
|
2. Using a simple if statement with nil comparison *CORRECT*
|
||||||
3. Using a mechanism called tagging
|
3. Using a mechanism called tagging
|
||||||
|
|
||||||
> **1:** There isn't a throw/catch block in Go; unlike Java, C#, and so on... Go is explicit.
|
> **1:** There isn't a throw/catch statement in Go; unlike Java, C#, and so on... Go is explicit.
|
||||||
|
|
||||||
|
|
||||||
## When you should handle the errors?
|
## When you should handle the errors?
|
||||||
|
@ -62,7 +62,7 @@ func main() {
|
|||||||
3. Change the done declaration of the main() to an assignment
|
3. Change the done declaration of the main() to an assignment
|
||||||
4. Change the done declaration of the short-if to an assignment. And, after the if statement, assign false back to the done variable. *CORRECT*
|
4. Change the done declaration of the short-if to an assignment. And, after the if statement, assign false back to the done variable. *CORRECT*
|
||||||
|
|
||||||
> **1:** That will break the program. The last line tries to print it.
|
> **1:** That will break the program. Because, the last line prints it.
|
||||||
>
|
>
|
||||||
> **2:** The program wants to use it to print true.
|
> **2:** The program wants to use it to print true.
|
||||||
>
|
>
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
// For more tutorials: https://blog.learngoprogramming.com
|
|
||||||
//
|
|
||||||
// Copyright © 2018 Inanc Gumus
|
|
||||||
// Learn Go Programming Course
|
|
||||||
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
|
||||||
//
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
|
||||||
// EXERCISE
|
|
||||||
// ?
|
|
||||||
//
|
|
||||||
// NOTE
|
|
||||||
// ?
|
|
||||||
//
|
|
||||||
// EXPECTED OUTPUT
|
|
||||||
// ?
|
|
||||||
// ---------------------------------------------------------
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
// For more tutorials: https://blog.learngoprogramming.com
|
|
||||||
//
|
|
||||||
// Copyright © 2018 Inanc Gumus
|
|
||||||
// Learn Go Programming Course
|
|
||||||
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
|
||||||
//
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
}
|
|
Reference in New Issue
Block a user