-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ce84d1
commit f5bba9c
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package main | ||
|
||
func main() { | ||
|
||
} | ||
|
||
// Inside the if statement we are creating a new variable called err. | ||
// We are not using the err variable declared as the function return argument. | ||
// The compiler recognizes this and produces the error. | ||
// If the compiler did not report this error, | ||
// you would never see the error that occured inside the if statement. | ||
// The return err variable is what is passed by default | ||
|
||
// func returnID() (id int, err error) { | ||
// id = 10 | ||
|
||
// if id == 10 { | ||
// err := fmt.Errorf("Invalid Id\n") | ||
// return | ||
// } | ||
|
||
// return | ||
// } |