Boolean not operator

dunsel8

New member
ASH doesn't seem to like what I'm trying.
I'm trying to do things like this:

if(!item_amount(myItem))
doStuff();

if(!equipped_amount(myItem))
doOtherStuff();

if (!adventure(my_adventures(), myLocation()))
abort("Something went wrong!");

Can any of these be done or do I have to use awkward constructions to get the logic I want?
 
You can use to_boolean() on the values there if you want to keep the same structure.

Edit: At least I think that would work, I don't actually use a lot of ASH.
 
to_boolean() would work:
Code:
> ash to_boolean( 0 )

Returned: false

> ash to_boolean( 1 )

Returned: true

> ash to_boolean( 2 )

Returned: true
although Heeheehee's solution seems clearer to me.
 
I think I've got this now. The ! operator only works on things that are or return boolean.

I'm used to weakly typed languages, I'll just have to change how I'm thinking about it.

Thanks!
 
Back
Top