Go choose language flow control structures if 01--

main Package 

Import "FMT" 

/ * 
string matching size 
number ratio of the first character appears in the character set, the first character the same character a second comparator, so 
go UTF8 compiler default character set 
appears in the character set numbers UTF8 the sequence is: 0123456789 
* / 
FUNC main031 () { 
	fmt.Println ( "0"> ". 9") 
	fmt.Println ( "012"> "011") 
	fmt.Println ( "0823"> "0423") 
} 

/ * 
is determined according to their birthday constellation user input: 
① single branch: if positioned between 0823-0922 (Virgo), outputs "! you also Zhennai God" * 
/ 
FUNC main032 () { 
	var birthday String 
	fmt.Println ( "Please enter your birthday, such as 0823") 
	fmt.Scan (& birthday) 

	IF birthday> "0823" birthday && < "0922" { 
		fmt.Println ( "Lord Zhennai people of God.") 
	} 

	Fmt.Println ( "End diagnosis") 
} 

/ * 
is determined according to their constellation birthday input by the user:
② double branch: If you are in between 0823-0922 (Virgo), outputs "! Lord is the God people", otherwise output "junk" 
* / 
FUNC main033 () { 
	var Birthday String 
	fmt.Println ( "Please enter your birthday, for example, 0823 ") 
	fmt.Scan (& birthday) 

	IF birthday>" 0823 "birthday && <" 0922 "{ 
		fmt.Println (" you also Zhennai God ") 
	} the else { 
		fmt.Println (" color Music ") 
	} 
} 

/ * 
determine their birthday constellation according to a user input: 
③ multibranched: Analyzing specific constellation 
* / 
FUNC main () { 
	var birthday String 
	fmt.Println ( "Please enter your date of birth, for example, 0823") 
	fmt.Scan ( Birthday &) 

	IF Birthday> = "0823" Birthday && <= "0922" { 
		fmt.Println ( "you also Zhennai God") 
	} the else IF Birthday> = "0923 "Birthday && <=" 1022 "{ 
		fmt.Println (" you are a Libra ")
	the else IF Birthday}> = "1023" Birthday && <= "1122" { 
		fmt.Println ( "you are a Scorpio") 
	} the else IF Birthday> = "1123" Birthday && <= "1222" { 
		fmt.Println ( "you Sagittarius ") 
	} the else IF (Birthday> =" 1223 "Birthday && <=" 1231 of ") || (Birthday> =" 0101 "Birthday && <=" 0122 ") { 
		fmt.Println (" you are a Capricorn " ) 
	} the else IF Birthday> = "0123" Birthday && <= "0222" { 
		fmt.Println ( "you are a Aquarius") 
	} the else IF (Birthday> = "0223" Birthday && <= "0229") || ( Birthday> = "0301" Birthday && <= "0322") { 
		fmt.Println ( "you are a Pisces") 
	} The else IF Birthday> = "0323" Birthday && <= "0422" { 
		fmt.Println ( "Lord Aries") 
	} the else IF Birthday> = "0423" Birthday && <= "0522" { 
		fmt.Println ( " I am a Taurus ") 
	} the else IF Birthday> = "0523" Birthday && <= "0622" { 
		fmt.Println ( " It is a Gemini ") 
	} the else IF Birthday> = "0623" Birthday && <= "0722" { 
		fmt.Println ( "you are a Cancer") 
	} the else IF Birthday> = "0723" Birthday && <= "0822" { 
		fmt.Println ( "Lord Leo") 
	} the else { 
		fmt.Println ( "you legendary Ophiuchus duck! ') 
	} 

}

  

Guess you like

Origin www.cnblogs.com/yunweiqiang/p/11774378.html