Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is it possible to write a horizontal if statement with a multi-line body?

Is it possible to turn this:

if cond1 == 2 and cond2 == 3:
    a = 5
    b = 6
    c = 7

into something like this:

if cond1 == 1 and cond2 == 2: a = 5, b = 6, c = 7

Note: I know this is not readable, recommended or practical but for the task I have at hand this is what I would like to know and use.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Just change the commas to semicolons:

if cond1 == 1 and cond2 == 2: a = 5; b = 6; c = 7
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading