小编CET*_*ETb的帖子

GoLang == true评估但未使用

在代码中,我尝试做一些操作

is_html := false;

// Check, if HTMl is exist 
for i := 0; i < len(modules_arr); i++ { 
    if modules_arr[i] == "html" { is_html := true }

}

if is_html ==true
{
    fmt.Printf("%v", "asdasd")
}
Run Code Online (Sandbox Code Playgroud)

但是我收到一个错误:

./api.go:26: missing condition in if statement
./api.go:26: is_html == true evaluated but not used
Error: process exited with code 2.
Run Code Online (Sandbox Code Playgroud)

syntax go

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

go ×1

syntax ×1