Top "Logic" questions

Logic refers to the ultimate flow of your code and how you arrive your desired solution.

Advanced Django Template Logic

I'm not sure if this is really easy and I just glanced over it in the documentation, or if this …

django templates django-templates boolean logic
Recursive power function: Why does this work if there's no initial return value?

because power(base, exponent) has no return value unless exponent is 0, initially, shouldn't power(base, exponent -1) return 'undefined', and …

javascript recursion logic return-value exponential
What is the maximum number of inputs for any logic gate?

In the references that we use, I usually see either a 2 or 3-input logic gate. Four-input gates come by once …

logic boolean-logic digital-logic
Evaluate if a value is increasing or decreasing (arduino)

I'm trying to learn how to evaluate if a value is increasing or decreasing. In this case I'm using a …

arduino logic arduino-ide
How to create a method to return 1 or 0 without using conditions?

I was asked a question in an interview to return 1 if provided 0 and return 0 if provided 1 without using conditions i.…

java c# logic logical-operators
End of month calculations

Just wondering if any know of an elegant solution for the following. If I have 30 June 2009 and I add a …

c# .net datetime date logic
Display 1,2,3,4,5,6,8,10,11 as 1-6,8,10-11

I have this sequence 1,2,3,4,5,6,8,10,11 Expected output is 1-6,8,10-11 This problem is about formatting the sequence in easy readable form …

c# java algorithm logic
How could I implement logical implication with bitwise or other efficient code in C?

I want to implement a logical operation that works as efficient as possible. I need this truth table: p q …

c++ c performance logic algebra
VHDL complement counter issues: converting std_logic to integer

Essentially, my question is: "can this not be done any easier?"; and what 'this' is, follows below (code too): I …

integer logic counter vhdl twos-complement
Pass two integers as one integer

I have two integers that I need to pass through one integer and then get the values of two integers …

logic xor