0

I used an OR operator in my if-else statement, I put two integers in the condition separated by ||. Syntax error shows..Why??

So here goes: void getdata(int x, int y) if (x=1 || y=1) { System.out.println("xx") } It is showing a syntax error that this operator does not support int,int..

24th Nov 2016, 3:35 PM
Aniket
3 odpowiedzi
0
have you tried System.out.println(x); ? What language is that? JavaScript, C++, Java?
24th Nov 2016, 11:24 PM
Johannes Weitnauer
Johannes Weitnauer - avatar
0
No, I haven't. It was just an example.
26th Nov 2016, 10:48 AM
Aniket
0
but what language is that? If it's Java, you need this: void getdata(int x, int y) { if(x == 1 || y == 1) { System.out.println("xx"); } }
26th Nov 2016, 11:06 AM
Johannes Weitnauer
Johannes Weitnauer - avatar