+ 2

Does OR work with ternary?

//Dosen't seem to like the || operator int j = 14 ; while(j>0){ txt(j>5?" ":j>6?||j>9?".":"*");--j; }

25th Sep 2017, 6:49 PM
D_Stark
D_Stark - avatar
6 Respostas
+ 3
Try: j>6 || j>9 ? Instead of: j>6 ? || j > 9
25th Sep 2017, 8:51 PM
Rrestoring faith
Rrestoring faith - avatar
+ 2
oh wait that didnt work either.. the txt is a static void print method btw i got an expression error
25th Sep 2017, 8:14 PM
D_Stark
D_Stark - avatar
+ 2
You removed the wrong question mark. Take a good look at @ace's comment! 😛
25th Sep 2017, 8:40 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
//here the whole thing public class Program { static void txt(String x){System.out.print(x);} public static void main(String[] args) { int j = 14 ; while(j>0){txt(j>5?" ":j>6?||j>9".":"*");--j;} }}
25th Sep 2017, 8:19 PM
D_Stark
D_Stark - avatar
+ 1
😥@ faith i dont understand i removed the ? after j>6 but i keep getting the same error... what did i miss restore my faith 😋
25th Sep 2017, 8:50 PM
D_Stark
D_Stark - avatar