avatar
Siz Long

My name is Siz. I am a computer science graduate student specializing in backend development with Golang and Python, seeking opportunities in innovative tech projects. My personal website is me.longsizhuo.com .Connect with me on LinkedIn: https://www.linkedin.com/in/longsizhuo/.

  • Resume
  • Archives
  • Categories
  • Photos
  • Music



{{ date }}

{{ time }}

avatar
Siz Long

My name is Siz. I am a computer science graduate student specializing in backend development with Golang and Python, seeking opportunities in innovative tech projects. My personal website is me.longsizhuo.com .Connect with me on LinkedIn: https://www.linkedin.com/in/longsizhuo/.

  • 主页
  • Resume
  • Archives
  • Categories
  • Photos
  • Music

GOlanguage# GOlanguage可爱捏

  2024-01-01        
字数统计: 216字   |   阅读时长: 1min

motorcycle.svg

1
2
3
4
5
6
7
8
9
package main

import "fmt"

func main() {
fmt.Println("Hello world")
arr := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
fmt.Println(a(arr))
}
1
2
3
4
5
6
7
8
9
10
package main

func a(x []int) []int {
for i := 0; i < len(x); i++ {
if i%2 == 0 {
x[i] = 1
}
}
return x
}
Modify the string
1
2
3
4
5
6
7
8
9
s := "hello"
c := []byte(s) // String s Convert []byte type
c[0] = 'c'
s2 := string(c) // Conversion back string type
fmt.Printf("%s\n", s2)

s := "hello"
s = "c" + s[1:] // Although the string cannot be changed,But sliced ​​operation
fmt.Printf("%s\n", s)

What to do if you want to declare a multi -line string?able to pass`To declare:

1
2
m := `hello
world`

` The string of the included isRawString,即String在代码中of形式就是打印时of形式,It has no character righteousness,Change will also output the original as the original

错误type

GoThere is a built -inerrortype,Specially used to process error information,GoofpackageThere is also a bag in iterrorsTo deal with errors:

1
2
3
4
err := errors.New("emit macho dwarf: elf header corrupted")
if err != nil {
fmt.Print(err)
}
  • Python
  • answer

扫一扫,分享到微信

微信分享二维码
brief_alternate Assignment
Inline expansion
目录
  1. 1. 错误type

150 篇 | 131.7k
次 | 人
这里自动载入天数这里自动载入时分秒
2022-2025 loong loong | 新南威尔士龙龙号