tagged [if-statement]
Are double square brackets [[ ]] preferable over single square brackets [ ] in Bash?
Are double square brackets [[ ]] preferable over single square brackets [ ] in Bash? A coworker claimed recently in a code review that the `[[ ]]` construct is to be preferred over `[ ]` in constructs...
- Modified
- 21 Jan at 15:19
if...else within JSP or JSTL
if...else within JSP or JSTL I want to output some HTML code based on some condition in a JSP file. How can I do that? Should I use JSTL?
- Modified
- 13 Jul at 13:47
Check if a variable is between two numbers with Java
Check if a variable is between two numbers with Java I have a problem with this code: ``` if (90 >>= angle = The left-hand side of an assignment must be a variable. I understand what this means but ho...
- Modified
- 13 Feb at 19:23
if statements matching multiple values
if statements matching multiple values Any easier way to write this if statement? `if (value==1 || value==2)` For example... in SQL you can say `where value in (1,2)` instead of `where value=1 or valu...
- Modified
- 29 Jul at 11:21
How should I rewrite a very large compound if statement in C#?
How should I rewrite a very large compound if statement in C#? In my C# code, I have an if statement that started innocently enough: It's growing. I think there must be 20 clauses in it now. How I be ...
- Modified
- 4 Aug at 21:54
C# if statement shorthand operators (? :) results in unreachable code
C# if statement shorthand operators (? :) results in unreachable code Why do I get this warning in C# with Visual Studio 2010? from the following code (`DateTime.Now` underlined in green squiggly): ``...
- Modified
- 17 Aug at 18:40
jQuery check if attr = value
jQuery check if attr = value I seem to be having trouble with my code. I need to say: When I check the console, I just get an error telling me this isn't a function. Help would be appreciated. Thanks,
- Modified
- 26 Jun at 15:55
Assignment in an if statement
Assignment in an if statement I have a class `Animal`, and its subclass `Dog`. I often find myself coding the following lines: For the variable `Animal animal;`. Is there some syntax that allows me to...
- Modified
- 18 Oct at 19:23
Using multiple IF statements in a batch file
Using multiple IF statements in a batch file When using more than 1 IF statement, is there a special guideline that should be followed? Should they be grouped? Should I use parenthesis to wrap the com...
- Modified
- 15 Jul at 18:29
Method with a bool return
Method with a bool return I was making a method with a `bool` return value and I had a problem: This works But this dosn't, the method can't detect a return value if it's in a IF-statement. How can I ...
- Modified
- 27 Sep at 15:24
break out of if and foreach
break out of if and foreach I have a foreach loop and an if statement. If a match is found i need to ultimately break out of the foreach.
- Modified
- 13 Jul at 14:34
Else clause on Python while statement
Else clause on Python while statement I've noticed the following code is legal in Python. My question is why? Is there a specific reason? --- `if``else``while``for``else``else``if`[I'm getting an Inde...
- Modified
- 12 Aug at 05:28
Redundant comparison & "if" before assignment
Redundant comparison & "if" before assignment Here is the example: I mean, if we assign the value of a variable to another one, why would we need to check if they have anyway the same value? That conf...
- Modified
- 22 Mar at 20:30
Check if a value is within a range of numbers
Check if a value is within a range of numbers I want to check if a value is in an accepted range. If yes, to do something; otherwise, something else. The range is `0.001-0.009`. I know how to use mult...
- Modified
- 31 Jan at 15:36
C# (If < or If >) vs Math.Sign
C# (If ) vs Math.Sign Might be a silly question, but is there any reason to use Math.Sign? Is there a speed/optimization thing with using Math.Sign rather than just using an if statement? Perhaps just...
- Modified
- 12 Mar at 18:42
Confusing If Statement?
Confusing If Statement? I always use If statement (In C#) as (1. Alternative); I know that there is no need to write "== true" as (2. Alternative)); But, I use it because it is more readable and cause...
- Modified
- 30 Aug at 10:26
How to do a logical OR operation for integer comparison in shell scripting?
How to do a logical OR operation for integer comparison in shell scripting? I am trying to do a simple condition check, but it doesn't seem to work. If `$#` is equal to `0` or is greater than `1` then...
- Modified
- 23 Feb at 13:4
If...Then...Else with multiple statements after Then
If...Then...Else with multiple statements after Then a very easy question: considering an `If...Then...Else` instruction in VBA, how can I separate multiple instructions after `Then`? In other words, ...
- Modified
- 23 Mar at 19:22
Multiple conditions in if statement shell script
Multiple conditions in if statement shell script I would like to know whether it is possible to have more than two statements in an `if` statement when you are writing a shell script? T
- Modified
- 12 Dec at 15:9
Negate if condition in bash script
Negate if condition in bash script I'm stuck at trying to negate the following command: This if condition returns true if I'm connected to the internet. I want it to happen the other way around but pu...
- Modified
- 29 Dec at 01:16
WPF Checkbox check IsChecked
WPF Checkbox check IsChecked I'm not talking about an event handler for this, but rather a simple `If Statement` checking if the `CheckBox` has been checked. So far I have: But that raises the error: ...
- Modified
- 5 Aug at 03:5
How do write IF ELSE statement in a MySQL query
How do write IF ELSE statement in a MySQL query How do I write an IF ELSE statement in a MySQL query? Something like this: Then down in my array I should be able to do this: ``` $row['state'] //this s...
- Modified
- 7 Dec at 06:23
IF a cell contains a string
IF a cell contains a string How can I assign a value to cells if it's neighbour contains a specific string? For example, fields in column A: The syntax in column B would be: It always picks up the fir...
- Modified
- 5 Sep at 23:44
How to implement if-else statement in XSLT?
How to implement if-else statement in XSLT? I am trying to implement an if -else statement in XSLT but my code just doesn't parse. Does anyone have any ideas? ``` date: $IDAppendedDate"> moo
- Modified
- 28 Jul at 00:6
add 0 before number if < 10
add 0 before number if
- Modified
- 22 Aug at 13:44