我试图只显示if语句的内容,如果if里面是if,则返回所需的值.但是这不起作用,所以我想你不是在TCL中这样做的.任何意见,将不胜感激.
if {$firstq == 1} {
set sql "SELECT * FROM users WHERE username='$text' AND ircban='yes' LIMIT 1"
set result [mysqlsel $db_handle $sql]
if{$result == 1} {
putquick "NOTICE $nick :User is banned."
} elseif{$result == 0} {
putquick "NOTICE $nick :User is not banned."
}
Run Code Online (Sandbox Code Playgroud)
这是因为丢失后的一个右括号elseif,你需要经过空间if和elseif:
if {$firstq == 1} {
set sql "SELECT * FROM users WHERE username='$text' AND ircban='yes' LIMIT 1"
set result [mysqlsel $db_handle $sql]
if {$result == 1} { ;# <-- Need space after if
putquick "NOTICE $nick :User is banned."
} elseif {$result == 0} { ;# <-- Need space after elseif
putquick "NOTICE $nick :User is not banned."
} ;# <-- Missing closing brace
}
Run Code Online (Sandbox Code Playgroud)