Created
May 24, 2020 16:23
-
-
Save alfianmalik/97228f7c03c026d895f300656f2c5df2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package errors | |
import ( | |
"fmt" | |
) | |
func printError(err bool, m string) string { | |
if err { | |
message = "You have encountered an error" | |
// Attempting to set 'message' to anything other than a string will result | |
// in a compiler error | |
} | |
return message | |
} | |
m := printError(true, "") | |
fmt.Println(m) // "You have encountered an error" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment