go the usual method
(1) obtain information screen user input
// import package fmt use fmt.ScanIn () or fmt.Scanf ()
var String name
var Age int
// the value of the user name entered into the address pointing
fmt.ScanIn (& name)
fmt.ScanIn (& Age)
fmt.Println ( "Please enter the user's name, age, separated by spaces divide")
fmt.Scanf("%s %d",&name,&age)
if branch
// golang if the support directly define a variable, e.g.
// if for, conditional statements without using brackets comprising up conditions
if Age: = 20 is ; Age> 18 is { fmt.Println ( " you have grown up " ) }
switch
Golang matching items in the back no need to add break
// basic syntax of the switch // can simultaneously test multiple values may meet the criteria, they are separated by commas, for example: case val1, val2, val3. // expression may be any type, and the expression 1 and expression 2, expression 3 can be any value of the same type. Or type is not limited to a constant integer, but must be the same type; or end result is the same type of expression switch expression { Case expression 1, expression 2, ...: statement blocks 1 Case Expression 3, expression 4, ....: statement block 2 default : statement block }