bug-gawk
[Top][All Lists]
Advanced

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

Re: how to get an unassigned value?


From: Wolfgang Laun
Subject: Re: how to get an unassigned value?
Date: Fri, 25 Jun 2021 22:15:40 +0200

$  awk -e ' BEGIN { x=x; print typeof(x) }'
unassigned

-W

On Fri, 25 Jun 2021 at 22:09, Peng Yu <pengyu.ut@gmail.com> wrote:

> I see the following two ways of getting an unassigned value. But
> neither of them is in the = form.
>
> $ awk -e 'function f() { }; BEGIN { x= f(); print typeof(x) }'
> unassigned
> $ awk -e ' BEGIN { a[1]; x=a[1]; print typeof(x) }'
> unassigned
>
> So there is not a way to write something like `x =
> some_way_to_represent_an_unassigned_value` to assign an assigned value
> to a variable?
>
> The following is cumbersome they required an extra definition of
> function of array. I am looking for a better way to express an
> unassigned value.
>
> x = f()
> x = a[1]
>
> --
> Regards,
> Peng
>
>

-- 
Wolfgang Laun


reply via email to

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