topics/go/language/control_flow/README.md
Control Flow in Go is similar to most C family languages but has some novel
differences. Classic structures like if and switch are present but their
syntax is a little different from what you might be used to.
There are no ternary operators.
if statements require an exact boolean expression. There is no "truthy" or "falsey".if statements may have a pre-expression similar to the first part of a for statement.switch statements do not require breaks and will not fall through by default.switch statements can have multiple values per case.|| "or" and && "and" operators for complex conditions.if statements (Go Playground)
switch statements (Go Playground)
variable names (Go Playground)
Write a program that inspects a user's name and greets them in a certain way if they are on a list or in a different way if they are not. Also look at the user's age and tell them some special secret if they are old enough to know it.
Template (Go Playground) | Answer (Go Playground)
All material is licensed under the Apache License Version 2.0, January 2004.