Can anyone help me with this please? I need OR to work like an else if. Thanks | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone help me with this please? I need OR to work like an else if. Thanks

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:31 PM
D_Stark
D_Stark - avatar
2 Answers
+ 4
ternary operator is suitable for simple if statements. what u r doing is against the purpose of its definition.
25th Sep 2017, 8:44 PM
Vahid Shirbisheh
Vahid Shirbisheh - avatar
+ 4
btw use ()
25th Sep 2017, 8:45 PM
Vahid Shirbisheh
Vahid Shirbisheh - avatar