Questions tagged [if-statement]
An "if" statement is a flow control structure in most programming languages that branches execution flow depending on a binary condition, generally evaluated at runtime. If statements are also commonly also called conditionals. When using this tag please also include an appropriate language tag, such as e.g. "java" if your question is language-specific.
if-statement
62,206
questions
0
votes
1
answer
22
views
SAS how to use character variable in if statment
I want to use character variable for if statement comparison, however why SAS always trying to treat it as numeric?
let VAR = "apple"
other code...
%macro Exec_day1();
If &VAR. eq &...
0
votes
1
answer
15
views
How if condition works in SAS background?
How do if works if i write the code below:
data B;
h= 1;
D="M";
run;
data c;
set b;
length nn $30;
type = vtype(H);
if type eq "N" then nn=put(h,best.);
else if type eq ...
0
votes
0
answers
3k
views
Iterations and multi-replacement
I have a file named file.in that contains 6 columns of data. One of the columns contains the mean and another contains the error. File.in is around 900 lines long with a different value for mean and ...
0
votes
1
answer
39
views
How to compare float numbers in an if conditional in BASH?
My code is:
#!/bin/bash
rm N_Matrix.csv
Lineas=`wc -l $1| awk '{print $1}'`
for (( i = 1 ; i <= Lineas ; i++ ));
do
Numer_1=`awk -vvar=$i 'NR==var' $1`
for (( j = 1 ; j <= Lineas ; j++ ))...
-2
votes
3
answers
88
views
How can I rewrite this block of if / Else if into a more structured, condensed and optimal way. (C#)
In C# .NET. This block of if/else if works fine, but its getting cumbersome to maintain and read. I want a more optimized writing style.
if (Globals.SRSI < 10 && Globals.SRSI != 0 &&...
-3
votes
3
answers
55
views
program doesn't start and there isn't an issue that comes up after I run it. While loops, myFunction() and if
I am making a program where you have to guess the secret password. If you don't then the program will alert you. I expect that the problem lies with label. I have tried innerText, innerHTML, ...
-7
votes
0
answers
33
views
Code will use "if", "else", "else if" statement [closed]
if, else, else if statement:
if
else
else if
Get JavaScript.
Get it for the JavaScript code.
Tips:
Use this if, else, else if statement.
Get if, else, else if statement.
What if the code will ...
0
votes
1
answer
13
views
PBI - Year total value does not reflect the DAX I wrote
Screen shot of my Dax and Table
All past data in actuals are finalized. If I only show actuals data, the full year graph looks off due to the rest of the year being 0.
So, we wanted to set if future ...
0
votes
0
answers
29
views
Depended dropdown with extra nested if statement
I have the following code, that works, for a depended dropdown menu.
Right now it does: IF column 5 <> "", then put depended dropdown of that name in column 6.
And if column 6 <> ...
-3
votes
1
answer
77
views
How to repeat an action until something specific is entered? [closed]
This was my original idea:
import os, time
while True:
os.startfile(r"c:\Users\owcor\OneDrive\Desktop\notepad.exe")
time.sleep(5)
inp = input("")
if inp == "...
0
votes
4
answers
74
views
Why does my if statement return false when using 'and not'? [duplicate]
I am trying to make a hangman game in python for practice(I'm pretty new to coding and a total newbie with python) When i try to check if a 'chosenLetter' is in 'randomWord' and not in the '...
0
votes
2
answers
77
views
Can an else if statement be used to create a step-wise reveal of elements with JavaScript?
Edit: Thank you! This problem is resolved. This was my first StackExchange question and you've all been very kind in responding so quickly, insightfully and thoroughly.
I'm building a page that has an ...
-4
votes
2
answers
38
views
Repeated result for if statement in python [duplicate]
token_list = ['lg', 'was', 'beaten']
defined_words = ['hand', 'leg', 'head', 'arm', 'finger', 'wrist', 'thigh']
for i in range(0, len(token_list), 1):
if token_list[i] in defined_words:
...
-1
votes
0
answers
11
views
Mark Cell as Y if 0, N is greater than 0 and cell to remain blank if no input and registered as a blank cell
I am trying to find a formula the will mark Cell as Y if 0, N if cell is greater than 0 and the cell to remain blank if there is no input in that cell
=IF(K18=0;"Y";"N") but if i ...
1
vote
1
answer
27
views
Multireplacement in .dat file lines
I have a .dat file. I want to read each line and replace a value in each line with a different value. Then save this to a new out.dat file. Every replacement is independent and I want to copy over the ...