Top "Logic" questions

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

Fastest way to get sign in Java?

I'd like to get the sign of a float value as an int value of -1 or 1. Avoiding conditionals is …

java optimization logic bit-manipulation
Django edit form based on add form?

I've made a nice form, and a big complicated 'add' function for handling it. It starts like this... def add(…

python django forms logic
Multi-variable switch statement in C#

I would like use a switch statement which takes several variables and looks like this: switch (intVal1, strVal2, boolVal3) { case 1, "…

c# .net switch-statement logic switch-expression
AND/OR (&&/||) logic for multiple condition statements

If you have an if-statement in C# that checks multiple conditions: if (a == 5 && b == 9) { ... } Does b == 9 still get …

c# logic conditional statements
Find the nearest/closest value in a sorted List

I was wondering if it is possible to find the closest element in a List for a element that is …

java logic
What are some practical applications of an FPGA?

I'm super excited about my program powering a little seven-segment display, but when I show it off to people not …

logic fpga digital
Java method to find the rectangle that is the intersection of two rectangles using only left bottom point, width and height?

I have found the solution but wanted to ensure my logic is the most efficient. I feel that there is …

java logic intersection
Ruby if .. elsIf .. else on a single line?

With the ruby ternary operator we can write the following logic for a simple if else construct: a = true ? 'a' : …

ruby logic
ASP.Net: Conditional Logic in a ListView's ItemTemplate

I want to show certain parts of an ItemTemplate based according to whether a bound field is null. Take for …

c# asp.net data-binding listview logic
Determining if a Powershell command was successful

Hi I am quite new to Powershell but I have one niggling question. I want to be able to tell …

powershell logic appcmd