Most voted "condition" questions
Use this tag on questions that have conditional execution as the center of the problem, i.e., that depend on boolean expressions for their execution.
Learn more…150 questions
Sort by count of
-
0
votes1
answer52
viewsSecond command does not work
I was testing the conditions, but when I use one command and then another, the second one isn’t working. c=str(input('')) if c == '/tutorial': print('ok, como vc é um hacker vc hackea td por…
-
0
votes1
answer32
viewsCreate unique content in Wordpress (no plugin)
I’m having a little trouble reasoning a decent logic for a wodpress theme present exclusive content. The idea is the following: I need to send an email, which will contain a parameter in the link…
-
0
votes0
answers54
viewsInclude one more condition to run Script
$outracondicao = 'S'; $script = new TElement('script'); $script->type = 'text/javascript'; $script->add("$(document).ready(function(){ window.setTimeout(function(){ var results = new…
-
0
votes1
answer32
viewsMYSQL and condition
I need to make a select in my same database is below: select * from tbl_frete f join tbl_transportador t on f.idtransportador = t.idtransportador join tbl_cliente c on f.idcliente = c.idcliente join…
-
0
votes0
answers37
viewsHow to show NULL in fields where the condition is not satisfied in SQL
I have this Input table (p): EmployeeID EventId EntityId EnterDate 11111 100 1 2:54:11 11111 100 1 2:54:43 11111 100 1 2:56:03 11111 100 1 2:56:35 11111 100 1 2:58:51 And this Output table (q):…
-
0
votes1
answer212
viewsIF condition - Good use practice
During an encoding I had to carry out the development in the following way: IF (Condicao1 = True) IF (Condicao2 = True) IF (Condicao3 = True) Imprime(Mensagem); The way I’ve accomplished is…
-
0
votes1
answer37
viewsHow to join two results in a conditional query
Talk, you guys! Would anyone know how to use a Union All on parole? Example: DECLARE @cond INT = 1 SELECT * FROM table1 IF(@cond = 1) BEGIN UNION ALL SELECT * FROM table2 END The idea is this but…
-
0
votes1
answer79
viewsJavascript condition
I started studying javascript recently and the following code is only giving me the wrong answer, where I went wrong? When I play at the prompt to see if it’s right, it gives me "n1 is odd" //…
-
0
votes0
answers103
viewsString vector condition error in C
I’m having a hard time with a specific exercise: #include <stdio.h> #include <stdlib.h> #include <locale.h> #include <windows.h> #include <ctype.h> #include…
-
0
votes0
answers39
viewsWhy isn’t my condition giving me the expected result?
I’m performing a line break without using the function wordwrap(). I will receive a string with the text, and an int with the allowed character length per line as parameter. I will have to cut this…
-
0
votes2
answers64
viewsWhy doesn’t the loop print up to the last value that was entered as the limit?
I made a code that prints a sequence of numbers, from the number typed to the end, but when printing it the last number is not appearing. Example: first number typed is 3 and the second is 7. The…
-
0
votes1
answer252
viewsConditionals in xml
I’m working on a arquivo.xml and I need to declare a property if the string I receive as parameter nay be empty. <condition> <property name="SHAZAM" value="Esse é o conteúdo…
-
0
votes0
answers43
viewsError in condition in Fortran
Because the code: program acosseno implicit double precision(a-h,o-z) PARAMETER(n=5) dimension x(n) dimension y(n) alfa=0.6D0 k1 = 3 k2 = 5 print *, "Alfa is: ", alfa open(1,file='a.dat') x(1) =…
-
0
votes0
answers42
viewsInform two totals of different hours and have as output the amount of hours between the two informed
In this problem I cannot use any ready lib!!!!! So, in Python 3, I must do what is asked, however, I’m having difficulties to implement this, until then I tried to calculate the differences of the…
-
0
votes1
answer155
viewsAdding a conditional to the XML TAG
I’m working on a.xml file to be sent to a service. However the question is how to add a conditional in XML, IE, I have N types of coverage that will be filled in a form and not all covers will be…
-
0
votes2
answers31
viewsError in condition return
even after typing a negative value, Else returns nothing ;( #include <stdio.h> int main (void) { //variaveis int dia, mes, ano; //inicio printf("\ndigite o dia: "); scanf("%d", &dia);…
-
0
votes2
answers161
views -
0
votes0
answers37
viewsString assigned to a variable that is not in a list
In this code below I want Python to return me the traffic signal of 4 simultaneous traffic lights. As the results are random, sometimes it returns me the correct that would be: One headlamp with…
-
0
votes2
answers76
viewsGoing into if wrong
I made this code and expected it to return me 'Jedi Master', but always returns 'Intermediate'. First I had done using switch-case instead of if-lse and it always returned me 'Invalid' (in the case…
-
0
votes1
answer149
viewsRecursive function JS
I’m studying a little recursive function and I came across an exercise that’s taking my sleep, because it’s a basic exercise and I don’t understand the way out. Basically the book asks to create a…
-
0
votes0
answers30
viewsWhat is a ternary conditional operator (?:)?
I was browsing the site looking for fonts for a reply and noticed that there is no no questions on the subject. As it is something very popular, I think it would be interesting to have an answer on…
conditionasked 4 years, 1 month ago Vitor Ceolin 464 -
0
votes1
answer51
viewsHow to make a condition that checks the variable type of a var
I was trying to do a basic program to make the rule of three, but I came across a problem, the user should write at the command prompt the two fractions and so I would give them a value var to…
-
0
votes1
answer72
viewsValidate password with Regex
I’m trying to do an exercise where I need to validate a password, I tried this format but the conditional if seems to ignore the second condition. I could not find the problem, which may be? { let…
-
0
votes1
answer47
viewsHow to apply the same condition/operation for each element of a vector in C
Hi, guys! I need to perform the same operation for all elements of a given vector. How to do this? More specifically, I need to check if an element any "x" has, in its two adjacent positions larger…
-
0
votes0
answers17
viewsCondition for file name
I need to make the following condition if the file name, which is a . json, has the characters VG, AP or GM pandas: if name_arquivo.str.contains('_VG_') or name_arquivo.str.contains('_AP_') or…
-
0
votes1
answer308
viewsHow to create a condition for each dataframe subset in pandas?
I wrote the following in order to create a condition for a subset of a dataframe in which case the cell value is higher than the average of that same subset(in this case the initial subset is small…
-
0
votes0
answers58
viewsCondition problems (if/Else) using React.js
My expectation: create a button that opens a modal for the user to enter information and this information turns a card to be shown on screen. The problem: I made an example in Codesandbox that…
-
0
votes0
answers18
viewsRolling Sum with conditions
I have the following dataframe data = data = [['1996-01-10', 10, 0], ['1996-01-10', 5, 0], ['1996-01-11', 4, 1], ['1996-01-13', 14, 1], ['1996-01-13', 1, 0], ['1996-01-13', 13, 0], ['1996-01-16',…
-
0
votes1
answer366
viewsCompound interest in Python using "while"
Recently I was trying to solve an exercise to learn Python, but I found big problems when I tried to calculate compound interest. I used the mathematical formula of the amount and simply I have no…
-
-1
votes2
answers381
viewsHow to create several variables of the same type without repeating conditions?
import java.util.ArrayList; import java.util.Scanner; class Main { public static void main(String[] args) { Categoria c1 = new Categoria(); c1.categoria = "-Reprodução"; c1.nome = "Ahmed Shafik";…
-
-1
votes5
answers2297
viewsStore IF output in a variable to use later
This code is in error when I call the variable $os: $os = (if($status_os_cliente == "A"){ echo "SIM"; } else{ echo "NÃO"; });
-
-1
votes2
answers103
viewsCode always falls on the same if
Why the method souVelho() only returns the answer "You’re new." regardless of the typed age? What’s going wrong? public class Pessoa{ private int idade; public Pessoa(int idadeInicial) {…
-
-1
votes1
answer499
views -
-1
votes1
answer101
viewsWhy does the IDE indicate that a code in the "if" will not be executed?
Observe the code: Because the development IDE is not considering line 34, 35 and 36 code? You weren’t supposed to be on probation?…
-
-1
votes1
answer119
viewsWho first executes the condition or code block in Python?
I’m having a problem and I believe it’s because of the execution order I can’t run such a block of code if it doesn’t go through a condition first if it won’t go wrong, and once I hear that in C it…
-
-1
votes1
answer52
viewsLARAVEL: Checking for SQL returns
I’m in need of some help! I have an SQL query in Laravel as follows: $cliente = DB::table('clientes')->where(DB::raw("cpf = '$cpf' AND (REPLACE(REPLACE(REPLACE(REPLACE(telefone1_num, '(', ''),…
-
-1
votes2
answers70
viewsHow to return a data message that does not meet a condition in a repeat loop?
Good night, you guys! I am studying C language by myself and, to train, I am trying to encode a program that reads inputs of metallurgical parameters (alloy, temper and thickness) so that a radius…
-
-1
votes1
answer51
viewsExplain to a beginner the query "if(! found)" in the code
I have an exercise that searches a number on a predetermined vector; and answers "was found and which vector position" or answers that "the number is not in the vector". I wanted the explanation of…
-
-2
votes3
answers284
viewsHow not to run script on mobile devices. in Wordpress
How to make a Script not run in wordpress, when someone is using a mobile device, tablet, or any mobile device. the script would look like this <script data-cfasync="false" type="text/javascript"…
-
-2
votes2
answers293
views"if" does not match the condition
I’m trying to apply a if in my code, but it’s coming wrong: <?php echo $usu_id . "<br />"; echo $centraliz . "<br />"; echo $marca . "<br />"; if($centraliz = "S"){ echo "É…
-
-2
votes1
answer692
views -
-2
votes2
answers3763
viewsCount letters and pick initials of the name
The program does not print the first letter of each name. nome[i]=nome[i+1]; I need to make a program that enters the name of the person, tells how many letters A has the name of that person and…
-
-2
votes3
answers94
viewsString validation using while in Python
The following code is intended to ask for the user’s gender ("f" or "m") and if the user typed another letter, he would continue to ask to type "f" or "m", however when executing it he keeps asking…
-
-2
votes1
answer76
viewsProgram problem that traverses two lists and generates a third without repeating elements
For a little over a week I’ve been trying to solve the following exercise: "Make a program that traverses two lists and generates a third without repeating elements." The statement in question is…
-
-3
votes3
answers174
viewsCondition "If" does not enter the structure
I’m having a problem with my code,I get an xlsx file, and I do the whole procedure correctly. but the file comes with some commas that need to be removed, and when I do the if to check if it has the…
-
-3
votes2
answers56
viewsStop the loop or not
Good morning, I’m having difficulty putting a condition in this loop: if tighten 1 loop for loop if tighten 2 out of loop resp=1 while resp==1: cliente_nome.append((input("Digite o nome do Cliente:…
-
-3
votes2
answers47
viewsHow do I make an delete button disappear after it appears when it is called in a click-like addeventlistener?
I would like the "remove time" button on the page not to appear again! The page comes with an already time field The remove time button does not appear on the rendered page When the user clicks on…
-
-3
votes1
answer61
viewsRedirect user if a class is removed
I created a theme and would like if (only if) the credits contained within the class creditos are removed or tampered with by someone, the page will be redirected to my portfolio. I found many…
-
-3
votes0
answers23
viewsSimplify Conditional VBA Code in MS Access
I am new in MS Access and VBA, but I have been doing well with my needs. I made a code to click a button on a form that checks if the required fields are filled and runs Word Mailmerge. However, the…
-
-6
votes1
answer72
viewsVariable validation
I saw some examples of variable checking to set values. For example: $nome ?? "Tem nome"; $nome or "Tem nome"; In this case, you have the reverse validation? I’d like to do something like that:…