Top "Conditional" questions

In computer science, conditional statements, conditional expressions and conditional constructs are features of a programming language which perform different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false.

Detect dashboard of WooCommerce "my account" pages

How can I detect if the "myaccount/my-account.php" template is used on the Dashboard. Currently I use: <?php …

php wordpress woocommerce conditional user-accounts
Conditionally add htmlAttributes to ASP.NET MVC Html.ActionLink

I'm wondering if it's possible to conditionally add a parameter in a call to a method. For example, I am …

c# asp.net-mvc parameters conditional actionlink
simplest way to check for just spaces in ruby

So I know in ruby that x.nil? will test if x is null. What is the simplest way to …

ruby conditional testing spaces
Replace negative values by NA values

I have positive, negative and NA values in a Table, I need to replace negative values by NA values. Positive …

r conditional missing-data assign
execute Ant task if TWO conditions are met

The above ant script implements if dir_is_empty then git-clone else git-fetch using Ant-1.7.1 core statements: <target name="…

ant conditional is-empty ant-contrib
C++ Multiple statements for conditional operator

I'm trying to use a conditional statement that does one thing in one condition but does two things if the …

c++ conditional statements
raise statement on a conditional expression

Following "Samurai principle", I'm trying to do this on my functions but seems it's wrong... return <value> if &…

python exception conditional raise zen-of-python
Angular 2 ngClass conditional with data?

So I am basically trying to set a highlight if an object is selected already. How can I compare the …

css angular conditional ng-class
How to use something like a continue statement in nested for loops?

I have a class of objects and need to compare one property of each object to the same property of …

c++ loops conditional nested-loops continue
Conditional with statement in Python

Is there a way to begin a block of code with a with statement, but conditionally? Something like: if needs_…

python conditional indentation conditional-statements with-statement