简体   繁体   中英

How to translate |= operator from JavaScript to Delphi ?

Today I faced an operator that I don't know what means in JavaScript, |= . Google doesn't help too much when you try to look for this "strange" characters. Someone knows what it means ? And How I convert it to Delphi ?

Thanks,

This

a |= b;

It is equal to this

a = a | b;

The operator | is called the bitwise OR operator and it

Returns a one in each bit position for which the corresponding bits of either or both operands are ones.

For further information regarding the bitwise operators in JavaScript, please have a look at Mozilla's JavaScript reference .

According to the Delphi documentation , I think that you are looking for the or operator:

a := a Or b;

It is bitwise or. In Delphi,

a := a or b;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM