Read this:
https://perl6advent.wordpress.com/2017/12/02/perl-6-sigils-variables-and-containers/

Then go back and read it again.  It took me several times, and I'm still
not sure I get it all :)


On Sun, Sep 16, 2018 at 8:49 PM ToddAndMargo <toddandma...@zoho.com> wrote:

> On 09/14/2018 08:07 PM, ToddAndMargo wrote:
> > ":D"
> >      means it wants actual data in the string and not a Nil.
> >      The jargon for this requirement is that is is constrained
> >      to an actual value
> >
> >      If it wanted a Nil, it would say ":U" or constrained to
> >      a Nil
>
> Iteration 3:
>
>
> ":D"
>      means it wants the variable "Defined" (Constrained).
>      For example:
>            my Str $x;
>            my Int $i;
>
>      The value of the variable may be empty but the variable
>      does not become "defined" until a value is places in it.
>      ("Nil" is seen as "Undefined")
>
> ":U"
>      means the variable is "Undefined" (defaults to type "Any")
>
>      For example:
>            my $x;
>            my $i;
>
>
>
> $ p6 'my $x; if $x.defined {say "Defined"}else{say "Undefined"};'
> Undefined
>
> $ p6 'my Real $x; if $x.defined {say "Defined"}else{say "Undefined"};'
> Undefined
>
> $ p6 'my Real $x=3; if $x.defined {say "Defined"}else{say "Undefined"};'
> Defined
>
> $ p6 'my $x=3; if $x.defined {say "Defined"}else{say "Undefined"};'
> Defined
>
>
> $ p6 'my $x=3; dd $x'
> Int $x = 3
>
> $ p6 'my $x; dd $x'
> Any $x = Any
>
> $ p6 'my Real $x; dd $x'
> Real $x = Real
>
> $ p6 'my Real $x = 3; dd $x'
> Int $x = 3
>
> Huh ??????
>

Reply via email to