help-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why string can be added with 0?


From: Peng Yu
Subject: Why string can be added with 0?
Date: Sun, 18 Jul 2021 21:41:16 -0500

I see this. I don't find anything about it in 6.2.1 Arithmetic Operators.

$ gawk '{ print typeof($1), $1 + 0 }' <<< a
string 0

But it seems that there should be an error to add a string to 0? Is it
better to show some error instead of assuming a string as 0 in the
context of arithmetic operations? Thanks.

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]