为什么可以';只有存在else子句时,if子句中才有awk group语句

为什么可以';只有存在else子句时,if子句中才有awk group语句,awk,grammar,conditional-statements,Awk,Grammar,Conditional Statements,如果这是好的awk语法 awk '{if (0) {print""}}' 这也是 awk '{if (0) print""; else print ""}' ,那么为什么这个语法不好 awk '{if (0) {print""}; else print ""}' 因为awk条件语法是 顺便说一句,就像在C中一样。这使得 if condition compound-statement ';' else compound-statement 错误。只需删除{print”“} if condi

如果这是好的
awk
语法

awk '{if (0) {print""}}'
这也是

awk '{if (0) print""; else print ""}'
,那么为什么这个语法不好

awk '{if (0) {print""}; else print ""}'

因为awk条件语法是

顺便说一句,就像在C中一样。这使得

if condition compound-statement ';' else compound-statement

错误。

只需删除
{print”“}
if condition compound-statement ';' else compound-statement