This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var noEscape = [256]bool{ | |
'A': true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, | |
'a': true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, | |
'0': true, true, true, true, true, true, true, true, true, true, | |
'-': true, | |
'.': true, | |
'_': true, | |
'~': true, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
m := make(map[string]int) //initialize | |
//map[keyType]valueType | |
m["Alice"] = 21 //Store Values to initialized |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#python 3.1 | |
x = 'hello' | |
y = 'world' | |
print(x + " " + y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// go/doc/GoCourseDay1.pdf Initialization example | |
package transcendental | |
import "math" | |
var Pi float64 | |
func init() { | |
Pi = 4 * math.Atan(1) //init() function computes Pi | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// go/doc/GoCourseDay1.pdf slide 62 | |
package main | |
import ( | |
"fmt" | |
"./transcendental" | |
) | |
var twoPi = 2 * transcendental.Pi //decl computes twoPi | |
func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A version of echo - go/docs/GoCourseDay1.pdf slide 59 | |
package main | |
import ( | |
"fmt" | |
"os" | |
) | |
func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package file | |
import ( | |
"os" | |
"syscall" | |
) | |
type File struct { | |
fd int // file descriptor number | |
name string //file name at Open time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"./iopkg" | |
"fmt" | |
"os" | |
) | |
func main() { | |
hello := []byte("hello, world\n") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"os" | |
"flag" // command line option parser | |
) | |
var omitNewline = flag.Bool("n", false, "don't print final newline") | |
const ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func f() { | |
for i := 0; i < 10; i++ { | |
g := func(i int) { | |
fmt.Printf("%d", i) | |
} | |
g(i) |