[Solved] How do I add ‘if’ commands inside a ‘why’ loop [closed]

It is because the if statement is not indented properly and its condition is not specified as a string ‘help’: while 1: userCommand = input(‘Type a command (type \’help\’ for syntax): ‘) if userCommand == ‘help’: print (‘flight: this command will be used to list a flight’) break solved How do I add ‘if’ commands … Read more

[Solved] Anyway I can shorten this IF statement? [closed]

I agree with others that there are many ways to simplify your code, but if you just want to simplify the if statement you can do this: if (!(x.contains(“6”)) && A1*B1*C1==6 && A2*B2*C2==6 && A3*B3*C3==6 && A1*A2*A3==6 && B1*B2*B3==6 && C1*C2*C3==6) The reason this works is that the only bags of three positive integers that … Read more

[Solved] Error: else without if. What went wrong? [closed]

You should do it with a switch : public static void main(String args[]) { System.out.println(“Enter 1 to Add, 2 to Subtract, 3 to Divide, or 4 to Multiply”); int x = keyboard.nextInt(); switch(x){ case 1: System.out.println(“Enter an integer”); int num1 = keyboard.nextInt(); System.out.println(“Enter another integer”); int num2 = keyboard.nextInt(); System.out.println(“The sum of the numbers equals … Read more

[Solved] If/Else Statements in C are not working

This: if(fare == -40){ char desc[50] = “Ouch! Cold either way!!”; } opens up a new scope, with a new local variable called desc, that “shadows” the one in the surrounding scope. This variable is initialized to the string, then thrown away as the scope exits. The variable of the same name in the parent … Read more

[Solved] IF ELSE in Java Script

Try the following: if (Group == ‘Customer’) { if(Status != ‘Agreement’) { cell.css (‘color’, ‘blue’); } } else if (Group == ‘Non-customer’) { if (Staus == null) { cell.css (‘color’, ‘green’); } else if (Status != ‘Agreement’) { cell.css (‘color’, ‘yellow’); } else if (Status != ‘Not declared’) { cell.css (‘color’, ‘purple’); } } solved … Read more

[Solved] How to make an if statement in c with two conditions?

Ok your question seems to be particularly unpopular… just for info, have a look at http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B The operator you are looking for is && but I should not tell you this since in fact as downvotes testify… your question is a bit lazy! I also know that sometimes when you are a noob it can … Read more