Order of CTX operators?

I am trying to make an update script condition that specifies only updating a document if the retrieved_utc is newer than the existing one and then after that, examine several other conditions. When I try to use parentheses, I get an error back for some reason (so I'm probably formatting it incorrectly) -- Without them, I don't get an error. This is what the conditions look like:

if (ctx._source.retrieved_utc < params.retrieved_utc && 
ctx._source.retweet_count < params.retweet_count ||
ctx._source.reply_count < params.reply_count ||
ctx._source.favorite_count < params.favorite_count)
{ctx._source.retweet_count = params.retweet_count;
ctx._source.reply_count = params.reply_count;
ctx._source.favorite_count = params.favorite_count;
ctx._source.updated_utc = params.updated_utc } else {ctx.op="none"}

Will it evaluate the AND and give it precedence over the ORs? Just to clarify, I want to first check if the document is newer (using the retrieved_utc field) and then go through the OR conditions and if any of the OR conditions are true, it will update the document.

UPDATE: I finally got the parenthesis to work! I must have had some issue with the formatting previously. The new statement looks like this:

if (ctx._source.retrieved_utc < params.retrieved_utc &&
(ctx._source.retweet_count < params.retweet_count ||
ctx._source.reply_count < params.reply_count ||
ctx._source.favorite_count < params.favorite_count))
{ctx._source.retweet_count = params.retweet_count;
ctx._source.reply_count = params.reply_count;
ctx._source.favorite_count = params.favorite_count;
ctx._source.updated_utc = params.updated_utc } else {ctx.op="none"}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.