Go is a compiled language.
Go natively handles Unicode, so it can process text in all the world’s languages.
Exercis e 1.3: Experiment to measure the dif ference in running time bet ween our pot ent ial ly
inefficient versions and the one that uses strings.Join. (Section 1.6 illustrates par t of the
time package, and Sec tion 11.4 shows how to write benchmark tests for systematic performance evaluation.)
几个名为dup的程序,其来源为Unix的uniq命令。
bufio.Scanner客户方便、有效率地读取输入和输出。Scanner读取输入,将它拆分为行或单词。
input := bufio.NewScanner(os.Stdin)
每次调用input.Scan()读取下一行,从结束处删除新行的字符(什么含义?)。
格式化输出字符格式,称为verb:
%d de cimal integer
%x, %o, %b integer in hexade cimal, octal, binar y
%f, %g, %e floating-p oint number: 3.141593 3.141592653589793 3.141593e+00
%t boole an: true or false
%c rune (Unico de co de point)
%s st ring
%q quot ed str ing “abc” or rune ‘c’
%v any value in a natural format
%T type of any value
%% literal percent sig n (no operand)
\t \n等称为escape sequence,代表不可见字符。
常量的值必须为数字、字符串或布尔值。
A handler pattern that ends with a slash matches any URL that has the pattern asaprefix。
switch-case