The "in" operator in a conditional expression

myarichuk
03 Dec 2018, 06:32

Hi everyone,

While working on Quest script parser (if you are curious or would like to participate, you can take a look at its repository), I am parsing the Core scripts, and I stumbled upon this piece of code:
if (result["key"] in current_value)

Couldn't find in the documentation what the "in" operator should do. Anyone knows what this operator should do?


The Pixie
03 Dec 2018, 08:04

It will return true if result["key"] is in the array or is a key in the dictionary current_value.

If you want to see if current_valuehas an attribute:

if (HasAttribute(current_value, result["key"]))

myarichuk
04 Dec 2018, 04:32

Many thanks!