摘要: golang 中本身不支持三目运算,如果想要简化代码,可以自定义一个三目运算的函数,通过函数的调用来实现三目运算 package main import ( "fmt" ) // 三目运算的函数 func ternary(a bool, b, c interface{}) interface{} { 阅读全文
posted @ 2021-08-22 16:17 GetcharZp 阅读(2467) 评论(0) 推荐(0) 编辑
摘要: ![](https://img2020.cnblogs.com/blog/1383776/202108/1383776-20210822112425405-573674684.png) ![](https://img2020.cnblogs.com/blog/1383776/202108/1383776-20210822112625525-531983361.png) ![](https://im 阅读全文
posted @ 2021-08-22 11:27 GetcharZp 阅读(32) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" "errors" ) type Stack []int // 入栈 func (s *Stack) push(a int) { *s = append(*s, a) } // 出栈 func (s *Stack) pop() (int, err 阅读全文
posted @ 2021-08-22 00:29 GetcharZp 阅读(192) 评论(0) 推荐(0) 编辑