Hi Marcos!
If you're using hilfe, you may occasionally notice that perfectly legal
code doesn't work. That's a result of the "magic" that makes incremental
compilation and evaluation in hilfe possible. I think this is one of
those occasions. I'm sure that someone with understanding of how hilfe
works under the covers can provide more details, or possibly a fix.
In the meantime, you can get around this error by using the following:
int x;
array y = ({ 1, 2, 3, 4 });
x = has_value(y, 5);
(2) Result: 0
Hope this helps.
Best,
Bill
[email protected]
On 2025-03-13 12:07, Marcos Cruz wrote:
I'm using Pike v8.0 release 1738 on Debian 12.9.
I got this:
```
int x;
x = has_value(({ 1, 2, 3, 4 }), -100); // result: 0
x = has_value(({ 1, 2, 3, 4 }), 0); // result: 0
x = has_value(({ 1, 2, 3, 4 }), 4); // result: 1
x = has_value(({ 1, 2, 3, 4 }), 5);
Compiler Error: 1: Bad argument 2 to has_value.
Compiler Error: 1: Expected: int(0..4).
Compiler Error: 1: Got : int(5..5).
```
I expected a result of 0 also with numbers greater than 4, after the
documentation
(http://pike.lysator.liu.se/generated/manual/modref/ex/predef_3A_3A/has_value.html#has_value).
Is it a bug or am I missing something?
Thank you in advance.