Hello Yury, I offer the following clarification, hopefully:

all($stuff == 0)  # checks if every element in $stuff is zero
all($stuff == 5)  # checks if every element in $stuff is 5
all($stuff)       # checks if every element in $stuff is boolean true
all($stuff) == 0  # checks if it is not the case that every element in
$stuff is boolean true
!all($stuff)      # same as above

Hopefully that clarifies what's going on. I think it's clearest if the
boolean condition is *inside* the parentheses of the all() function call,
as in the first two examples.

David


On Fri, Dec 22, 2023 at 9:19 AM Yury Pakhomov <pakho...@inasan.ru> wrote:

> Hello All
>
> I faced with strange behavior in function "all"
>
> $a=pdl(1,1,1,0);
> print all($a)==0;
>
> returns 1
>
>
> Best regards,
>
> Yury
>
>
>
>
> _______________________________________________
> pdl-general mailing list
> pdl-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pdl-general
>


-- 
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan
_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to