Questions tagged [nested-if]

This tag refers to a code structure in which multiple if-statements are placed in a "nested" form (i.e. one if-statement is contained within another).

Use this tag for questions related to constructing, maintaining, or refactoring nested if-statements.

428 questions
0
votes
1 answer

Nested If/Cond Scheme

I'm having a hard time getting a simple nested if statement to work. I have two functions divisible2? and divisible3? and I want to see if a certain number - n is divisible by both 2 and 3. Here's what I have so far: (define (divisible2? x) (zero?…
Nelson.b.austin
  • 3,080
  • 6
  • 37
  • 63
0
votes
5 answers

Correct way to write nested if statements?

numberHands will be equal to 1,2, or 3. It will never make it this far in the program if not. So I see no reason for else statements. But, is this the correct syntax for writing nested if statements in JavaScript? I feel like the closing brackets…
CRABOLO
  • 8,605
  • 39
  • 41
  • 68
0
votes
2 answers

Java While loop not adding correctly

I can't figure out why this isn't adding up correctly each time it loops. There's also a problem with the while loop not outputting the sum when -9999 is typed in. import java.util.*; public class list { public static void main(String args []) …
Joe
  • 9
  • 1
0
votes
3 answers

Inner if statement is skipped for some reason during debug and run

The inner if statement is being skipped completely, when I step through the code It never enters updateGrade. It just skips the if entirely. why? heres the method in question: public void updateCourse(String courseID, String newLetterGrade){ …
Cody Mallery
  • 131
  • 3
  • 12
0
votes
2 answers

batch: if..then..else nested make me mad

I've wrote a subroutine with some if..else nested Unfortunately i can't understand why my code are executed before and after the "ELSE" (!!) I read it for hours, but i don't find any error.. can you help me? I copied the code (with a lot of…
CSG
  • 247
  • 5
  • 14
0
votes
4 answers

awk with nested if else

I have a tab delimited two column data. I want to get the third based on the condition applied on second column. if second column is not equal to zero it should print col 1 and 3 and ratio of col1/col2 if col two is zero and col one is more than 15…
Angelo
  • 4,829
  • 7
  • 35
  • 56
0
votes
1 answer

issue with nested if?

Possible Duplicate: Django templates syntax error When i am using {% if request.user.is_authenticated %} condition for redirection on this code it throws error Invalid block tag: 'else' {% if request.user.is_authenticated %} {% extends…
-1
votes
2 answers

Nested if else statement is not working as desired

In the program, no errors. PASS, CLEARED user inputs are working as desired. But when I enter NO as user input in the nested if, control picks "else statement" correctly, but also it is going inside, and executing the next S.O.P display like "Have…
-1
votes
0 answers

Python Try / Except stopping my nested if statements from function correctly (new)

I have a set of if statements where if the user selects 1 they will be brought to a movie menu and if they select 2, they will be brought to a tv shows menu. In both these if statements are nested if statements which relate to each movie title they…
-1
votes
1 answer

How to Move a Row to Two Different Locations on a Different Google Sheets Tab Based off Two Different Criteria

I would like to copy and paste a row from one google sheet tab titled "New Projects" to another google sheet tab titled "Project Tab" if column H says "Approved" and then clear the row that was copied. Additionally, I would like the destination of…
-1
votes
1 answer

How we will convert nested if - else code into list comprehension in python

I have tried and google the solution for below mentioned code but unfortunately I didn't get anything regarding this. Don't change the logic pleaseConvert it into list comprehension. I Have tried list comprehension. I'm bit far from getting…
-1
votes
1 answer

Google Sheets Query With Multiple IF Statements

I am trying to run a some nested IF statements with a query (with an import range to another sheet). Such that, if cell B2 is 'ABC', it will query the ABC sheet and return the value of a cell on that sheet. Same for the other two sheets, 'XYZ' and…
-1
votes
1 answer

Alternative to Nested if statements Flask

Summary I have built a flask application thats taken several inputs from the user and the inputs need to be verified to certain criteria. If the inputs are not verified correctly, a flash message will show depicted what is incorrect of the…
Callum
  • 231
  • 1
  • 3
  • 12
-1
votes
2 answers

Add columns to an existing source of data

I would like to add several columns to an existing source of data displayed in a sheet. But as a data source, the number of rows can increase. I don't want to update the sheet once it is set up, it should be automatic. In those new columns, I would…
z0om
  • 133
  • 1
  • 10
-1
votes
2 answers

Alternate solution for multiple nested if/elif in python

I have been trying a code using multiple if statement but this process seems to take more execution time if the number of observations are many. Basically the code checks the value in two columns (rate and rate_tenor) and if condition matches in…
Titu
  • 1
  • 3