tagged [if-statement]
check if variable empty
check if variable empty 1. Is there any shortest way to do it ? 2. And if i right, it should be tested with is_null? 3. It's possible $user_id, $user_name and $user_logged write in one line (ma
- Modified
- 8 Jan at 12:42
Python syntax for "if a or b or c but not all of them"
Python syntax for "if a or b or c but not all of them" I have a python script that can receive either zero or three command line arguments. (Either it runs on default behavior or needs all three value...
- Modified
- 7 Sep at 01:35
If "0" then leave the cell blank
If "0" then leave the cell blank I am trying to create a simple ledger and on the far right of the "Book" it totals any debit/credit that I input. But instead of leaving the unused rows blank, it keep...
- Modified
- 6 Dec at 20:49
Does it matter performance wise if there is an `else` after the first `return`?
Does it matter performance wise if there is an `else` after the first `return`? I've now seen two different ways to make a boolean returning method: Which one is faster? Does it make sense to not writ...
- Modified
- 31 Dec at 15:48
List comprehension with if statement
List comprehension with if statement I want to compare 2 iterables and print the items which appear in both iterables. But it gives me a invalid syntax error where the `^` has been placed. What is wro...
- Modified
- 29 Nov at 20:50
javascript: building a conditional off of array items
javascript: building a conditional off of array items if I have an array like this: how could I go about building a conditional like so: the caveat is that I do not know how many items could be in thi...
- Modified
- 20 Jan at 15:35
shorthand If Statements: C#
shorthand If Statements: C# Just a quick one, Is there anyway to shorthand this? It's basically determining the direction left or right, 1 for left, 0 for right In C#: The statement following this wil...
- Modified
- 8 Jun at 09:41
One-liner if statements, how to convert this if-else-statement
One-liner if statements, how to convert this if-else-statement Total noob here so be gentle. I've looked everywhere and can't seem to find the answer to this. How do I condense the following? I can't ...
- Modified
- 7 Jan at 04:54
Conditional C# breakpoint?
Conditional C# breakpoint? I'm debugging a `foreach` loop which will iterate well over 1000 times - so I only want a breakpoint within the loop to break for a particular item. So... Do I have to write...
- Modified
- 30 Apr at 16:12
Not Equal to This OR That in Lua
Not Equal to This OR That in Lua I am trying to verify that a variable is NOT equal to either this or that. I tried using the following codes, but neither works: Is there a way to do this?
- Modified
- 25 Jul at 21:33
Unexpected 'else' in "else" error
Unexpected 'else' in "else" error I get this error: > Error: unexpected 'else' in " else" From this `if, else` statement: ``` if (dsnt
- Modified
- 22 Jun at 19:16
Will an IF statement stop evaluating if it fails the first condition?
Will an IF statement stop evaluating if it fails the first condition? If I have an `If` statement with 2 conditions - and the first fails, will the 2nd condition even be considered or will it go strai...
- Modified
- 6 Jul at 08:28
Multiple IF statements between number ranges
Multiple IF statements between number ranges I'm trying to set up a formula with multiple IF statements between number ranges but I'm seeing the error: > Formula parse error Here is the forumula: ``` ...
- Modified
- 14 Jul at 11:41
Java function Else issue
Java function Else issue Sooo I'm having an issue with my function. Well soo my issue is : if x is even, return x/2 OR is x if odd. returns 3x+1. But when I try to compile java tells me that ( 'else...
- Modified
- 8 Feb at 03:20
MySQL IF ELSEIF in select query
MySQL IF ELSEIF in select query I'm trying to select different prices of a product based on the quantity that user chooses. This is the query I'm working on (it has a syntax error): ``` select id, (...
- Modified
- 10 Sep at 13:56
Perl - Multiple condition if statement without duplicating code?
Perl - Multiple condition if statement without duplicating code? This is a Perl program, run using a terminal (Windows Command Line). I am trying to create an "if this and this is true, or this and th...
- Modified
- 14 Feb at 00:12
How to have multiple conditions for one if statement in python
How to have multiple conditions for one if statement in python So I am writing some code in python 3.1.5 that requires there be more than one condition for something to happen. Example: The problem is...
- Modified
- 21 Apr at 01:24
How can I express that two values are not equal to eachother?
How can I express that two values are not equal to eachother? Is there a method similar to `equals()` that expresses "not equal to"? An example of what I am trying to accomplish is below: ``` if (seco...
- Modified
- 14 Jan at 17:7
Single line if statement with 2 actions
Single line if statement with 2 actions I'd like to do a single line if statement with more than 1 action. Default is this: But I don't need an "else" only, I need an "else if" like that in multi line...
- Modified
- 18 Sep at 20:1
Syntax for an If statement using a boolean
Syntax for an If statement using a boolean I just recently joined the python3 HypeTrain. However I just wondered how you can use an if statement onto a boolean. Example: And also, can I just switch t...
- Modified
- 27 May at 18:4
How to check if a string contains an element from a list in Python
How to check if a string contains an element from a list in Python I have something like this: I am wondering what would be the more elegant way to do this in Python (without using the for loop)? I wa...
- Modified
- 16 Jun at 09:53
Meaning of "[: too many arguments" error from if [] (square brackets)
Meaning of "[: too many arguments" error from if [] (square brackets) I couldn't find any one simple straightforward resource spelling out the meaning of and fix for the following BASH shell error, so...
- Modified
- 8 May at 23:26
Compare cell contents against string in Excel
Compare cell contents against string in Excel Consider the following: I need a formula to populate the `B` column with `1` if the `A` column contains the string `ENG`, or `0` otherwise. I've tried (in...
- Modified
- 25 Apr at 21:10
How to SUM parts of a column which have same text value in different column in the same row
How to SUM parts of a column which have same text value in different column in the same row I have a column with names and a column with numbers: Names with same `FirstName` a
- Modified
- 28 Sep at 23:9
If statements for Checkboxes
If statements for Checkboxes I wanted to know how to write if statements to see if one or another check box is checked or not. I have two check boxes. I wanted it to check to see if checkbox 1 is chec...
- Modified
- 7 Aug at 16:8