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 there an equivalent if statement in java as this python one?

I usually code python, but decided to try to learn a new language (Java). I am a complete beginner with around 2 hours of experience. In python, we can use "or" so that if one condition is satisfied it executes the block of code.EG:

if x>y or 10<12:
  print("one of these is true")

is there an equivalent for this in java ?

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 :

I quess

if( x > y || 10 < 12) { 
System.out.println("one of these is true"); 
}

should do the thing.

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