Lua 4.0 Unconfirmed variables and conditional statements

This code confuses me.

print(gogo)
if (gogo == true) then
print("yes")
elseif (gogo == false) then
print("no")
end

Why gogo evaluates to true ? Shouldn’t it produce an error?

It does not evaluate to true, it cannot, because there is no boolean type in Lua 4.0.

print(true) - prints "nil"

By default, undefined global variables are zero, so gogo == true. They All are zero.

This code confuses me.

print(gogo)
if (gogo == true) then
print("yes")
elseif (gogo == false) then
print("no")
end

Why does gogo evaluate as true? Shouldn’t it produce an error?

It does not evaluate to true, it cannot, because there is no boolean type in Lua 4.0.

< pre>print(true) – prints “nil”

By default, undefined global variables are zero, so gogo == true. They are all zero.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3196 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.