<input type="button" onclick="函数名()">

JS所有的事件名称都是以on开头
def estimate_house_sales_price(num_of_bedrooms, sqft, neighborhood):

price = 0




# In my area, the average house costs $200 per sqft

price_per_sqft = 200




if neighborhood == "hipsterton":

# but some areas cost a bit more

price_per_sqft = 400




elif neighborhood == "skid row":

# and some areas cost less

price_per_sqft = 100




# start with a base price estimate based on how big the place is

price = price_per_sqft*sqft




# now adjust our estimate based on the number of bedrooms

if num_of_bedrooms == 0:

# Studio apartments are cheap

price = price — 20000

else:

# places with more bedrooms are usually

# more valuable

price = price + (num_of_bedrooms * 1000)

return price
def estimate_house_sales_price(num_of_bedrooms, sqft, neighborhood):    
price = 0
# In my area, the average house costs $200 per sqft
price_per_sqft = 200
if neighborhood == "hipsterton":
# but some areas cost a bit more
price_per_sqft = 400
elif neighborhood == "skid row":
# and some areas cost less
price_per_sqft = 100
# start with a base price estimate based on how big the place is
price = price_per_sqft*sqft
# now adjust our estimate based on the number of bedrooms
if num_of_bedrooms == 0:
# Studio apartments are cheap
price = price — 20000
else:
# places with more bedrooms are usually
# more valuable
price = price + (num_of_bedrooms * 1000)
return price
type config struct {
Home string `env:"HOME"`
Port int `env:"PORT" envDefault:"3000"`
IsProduction bool `env:"PRODUCTION"`
Hosts []string `env:"HOSTS" envSeparator:":"`
Duration time.Duration `env:"DURATION"`
TempFolder string `env:"TEMP_FOLDER" envDefault:"${HOME}/tmp" envExpand:"true"`
}

func main() {
cfg := config{}
if err := env.Parse(&cfg); err != nil {
fmt.Printf("%+v\n", err)
}

fmt.Printf("%+v\n", cfg)
}
package main

import "fmt"

func main() {
var a = 0.0
const b = 0.0
fmt.Println(a / b)
}
type config struct {
Home string `env:"HOME"`
Port int `env:"PORT" envDefault:"3000"`
IsProduction bool `env:"PRODUCTION"`
Hosts []string `env:"HOSTS" envSeparator:":"`
Duration time.Duration `env:"DURATION"`
TempFolder string `env:"TEMP_FOLDER" envDefault:"${HOME}/tmp" envExpand:"true"`
}

func main() {
cfg := config{}
if err := env.Parse(&cfg); err != nil {
fmt.Printf("%+v\n", err)
}

fmt.Printf("%+v\n", cfg)
}
using CliWrap;

var result = await Cli.Wrap("path/to/exe")
.WithArguments("--foo bar")
.WithWorkingDirectory("work/dir/path")
.ExecuteAsync();

// 输出包括:
// -- result.ExitCode (int)
// -- result.StartTime (开始时间)
// -- result.ExitTime (结束时间)
// -- result.RunTime (执行命令耗时)
if expr {
n = trueVal
} else {
n = falseVal
}
 -p ":8081"  监听8081
-p ":8081,:8082" 监听8081和8082
-p ":8081,:8082,:9000-9999" 监听8081和8082以及9000,9001至9999,共1002个端口
package main

func main() {
var a = 1
if a != 1 {
println("oh no")
}
}
time GOPATH=/tmp/throw GO111MODULE=on GOPROXY=https://goproxy.io go get github.com/go-sql-driver/mysql
...
real    0m0.934s
user    0m0.188s
sys    0m0.093s
var args struct {    Input    string   `arg:"positional"`    Output   []string `arg:"positional"`    Verbose  bool     `arg:"-v" help:"verbosity level"`    Dataset  string   `help:"dataset to use"`    Optimize int      `arg:"-O" help:"optimization level"`}arg.MustParse(&args)
package main

import "fmt"

func main() {
fmt.Println(func() {} == func() {})
}
package main

import "fmt"

func main() {
fmt.Println(func() {} == func() {})
}
var args struct {   
Input string `arg:"positional"`
Output []string `arg:"positional"`
Verbose bool `arg:"-v" help:"verbosity level"`
Dataset string `help:"dataset to use"`
Optimize int `arg:"-O" help:"optimization level"`
}
arg.MustParse(&args)
package main

func main() {
var a = 1
if a != 1 {
println("oh no")
}
}
-p ":8081"  监听8081
-p ":8081,:8082" 监听8081和8082
-p ":8081,:8082,:9000-9999" 监听8081和8082以及9000,9001至9999,共1002个端口
type Widget struct {
id int
attrs []string
}
//下面两种传参有什么区别?
func doSomThing(ss *[]Widget){

}
func doOtherThing(sp []*widget){

}
  • 1
  • 2
  • 3
  • 4
  • 5