go程序设计语言第一章-入门

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值