To create an if statement with an else if and else in Go, you can use the following syntax:
main.go243 chars8 lines
Here's an example:
main.go289 chars16 linesIn this example, the first condition checks if age is less than 18. If it's true, the program prints "You are not eligible to vote." If it's false, the program checks the second condition. If that is true, the program prints "You are eligible to vote." If both conditions are false, the program executes the code in the else block and prints "You are not eligible to vote."
gistlibby LogSnag