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
-2
votes
1 answer

C++ nested If statement, it doesn't work as expected

StackOverflow fellow developers, I am doing some Arduino coding to working with measuring Fine Dust Monitoring Device, However, I have a question regarding with If-statement. In the code below, I added nested-if statement in the while loop, and some…
HappyBono
  • 36
  • 8
-2
votes
2 answers

Handling nested ladder python

I have some multiple condition with boolean in dictionary d = { "statement01" = True, "statement02" = True, "statement03" = False, "statement04" = False, "statement05" = False } And I use if…
-2
votes
1 answer

Google Sheets - Multiple IF, ISNUMBER, SEARCH statements in one cell

I have several lists of groups and their members. A member can belong to more than one group. I want to find out which groups each member belongs to. Since each group name has its own cell I'm basically trying to search for a name in a range of…
-2
votes
1 answer

Nested if or code multiple times?

As I couldn't find a question similar to my construct, I am going to ask it. I have following code: for (Object o : array1) { for (Object o2 : array2) { if (condition1) { //get a variable for condition2 (depends on iteration…
XtremeBaumer
  • 6,275
  • 3
  • 19
  • 65
-2
votes
2 answers

Nestes if's in python not working and math module faulty

in this code i first ask the user for the trigonometric function and then ask for the angle in radians or degrees. according to the code, the console should print error, but on running the code, the first if statements accept any input as true.the…
-2
votes
2 answers

Nested JS if statement not working properly

I am using a counter to display appropriate information upon each click, but I can not get the button to work past one click. I believe I am adding to my counter correctly but for some reason it is not registering properly. Any modifications would…
user7366442
  • 731
  • 2
  • 9
  • 16
-2
votes
2 answers

NESTED IF's in PL/SQL

I am trying to write nested IFs in a pl/sql block. How do I arrange properly. IF r1.CABLE_TYPE = "A" THEN var_root = FC_CPSCBPR1.C_111_SCPSCBP Logic I have to include now If var_root is "TRUE" /*If the value is populated*/ THEN IF ... …
Soom Satyam
  • 25
  • 1
  • 1
  • 7
-2
votes
1 answer

VBA - Top 10 percent of each region

I have an Excel 2013 spreadsheet that, among other things, shows the Income for assets in different Districts. I'm writing a macro that will enter a date in an empty cell next to the income IF that income is in the top 10 percent for that District…
elt2jdavis
  • 231
  • 2
  • 3
  • 13
-2
votes
1 answer

I'm trying to check for acceptable height and weight and have the c++ compiler output why a candidate is rejected

When only the weight is wrong, the following C++ code does not output any rejection message. What is wrong with my nested if-then-else checks? char gender; //INPUT Gender of candidate char genderOk; //INPUT Checks validity of input for each…
-2
votes
2 answers

nested if statedments, what am i doing wrong

homework question is-----Write code that tests the variable x to determine whether it is greater than 0. If x is greater than 0, the code should test the variable y to determine whether it is less than 20. If y is less than 20, the code should…
-3
votes
3 answers

How do I print if someone is or not eligible to vote by using nested if statement?

I'm trying to print simple lines of text using nested if statement. but somehow relational symbols return an always false: //unfinished import java.util.Scanner; public class exe6 { public static void main(String[]args){ Scanner sc = new…
-3
votes
4 answers

how to avoid logic errors in python using the control flow and nested if statements?

I'trying to write code that helps you decide whether you should or shouldn't eat food if you have droppped it. But it doesn't print the decision if too many conditions are met e.g if someone who is a boss/lover/parents has seen me droping the food…
-3
votes
1 answer

How do I optimize nested if statements? I cannot use && here

Is there a better way in which this can be written? I'm new to python coding and I want to improve below lines of code. I have included a few lines of my code here but the original code is much longer than this(multiple if statements). Any…
-3
votes
2 answers

NESTED IF in Oracle SQL

--mesinicio parameter goes here IF 1 = 1 THEN ---cantmeses parameter also here IF 1 = 1 ---Invalid SQL statement THEN SELECT a.ctainterna, a.ejercicio, a.cuenta, a.nombre, a.dapertura, a.hapertura,a.dene,…
Zeta
  • 25
  • 6
-3
votes
3 answers

Sorting a list from low to high from the left in python, using if statements

I have an assignment, where I'm to sort a list from low to high. But my program gives out an inverse of the expected order. This is my futile attempt at the assignment. Please help me I am genuinely stuck. Hopefully it is a noob mistake. from random…
user4998157
1 2 3
28
29