Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

OR in python?

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
User avatar
Fiasco
Plugin Developer
Posts: 222
Joined: Fri Jul 24, 2009 5:32 am
Location: St. Louis MO
Contact:

OR in python?

Post by Fiasco »

Silly question (perl programmer here)

How do I do

if x == 1 or x == 2:
execute this

in python?
User avatar
Fiasco
Plugin Developer
Posts: 222
Joined: Fri Jul 24, 2009 5:32 am
Location: St. Louis MO
Contact:

Re: OR in python?

Post by Fiasco »

Figures it out 10 seconds later

if (x == 1) | (x==2):
Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: OR in python?

Post by Bartman »

You could have it written exactly as in the question

Code: Select all

if x == 1 or x == 2:
In your answer you actually do a bitwise combination of to boolean values.
Post Reply