Category "if-statement"

Reload does not change POST state

I have a problem where I want to reload the page on submit. I did this with the simple script function shown below. However, the echo'd "hello" does not disappe

How to optimise a condition which checks for each object of an array of objects whether specific properties are not undefined?

I want code optimisation for an if-statement because I otherwise have to add more key-value pairs into this condition with &&. I have an array of object

Parse column values line by line and pass to ifelse

I have code in shell script, but can't figure out how to parse line by line in column. If person is absent I want to send email. if person is late than hour the

How to optimise function logic to avoid duplication - python

I have some code below, for a given name that matches pattern with 2 lower case letters (such as 'aa'), the valid name can be V-aa or X-aa def verify_helper(val

Calling a method from one class to another to get its value

package Multiplemethods; import java.util.stream.DoubleStream; public class TimeOffice { public static void main(String args[]){ //instance variables dou

Find the longest integer in a vector using while loops

Working on this program that's supposed to take a vector of integers as input and return the one with the longest integer. Example (vector 20 738 5942 125) and

Python - if ... then with multiple wildcards

I use the following python snippet within my code to scan a given soup for keywords. It´s only possible that one of the word is inside the soup. Concernin

is there a way assign IF statement or Switch Case to a variable

I am trying assign grades for input integers. But I found it difficult to complete the code. Is there any other way to do the below code such that it will give

Paste together results within case_when (if-else) statements

I want to paste together results within the same case_when statement (i.e., if multiple statements are true for a given row). I know that I could do something l

How can I make a def function with my "if" statements?

We were asked to make a function named temperature conversions that accepts an integer argument called temperature, a secondary string parameter called input un

Exception based on condition on Apps Script in Google Sheet

With this script I can exclude to insert the same value column in Google Sheet for maximum 100 times. But I am trying to exclude (with if statement) some values

Finding max consecutive 1 in a given array (leetcode)?

class Solution { public: int findMaxConsecutiveOnes(vector<int>& nums) { int ctr = 0, max = 0; for(int i=0; i<nums.size(); i++)

conditional binary operator expected with Do and ssh connection

This is part of my code that I working to find a word in a remote server connecting via ssh to that server filename=test.repo word=fail exists=$(grep -c $word $

Excel - multiple value search across multiple columns or one column with multiple values

I have 7 criteria = TMO-1 through to TMO-7 I have two scenarios to search from. i have either got a single excel with TMO-6, TMO-201, TMO-67,... etc (some have

How do i write nested if statement? [closed]

So i want to make a simple if statement like this : if(a=1) { if(variable1=1) { cout<<"a1=1"; } else {

Check if user input is between two floats - Python

I am currently working on a small project that will take a user input such as "50", and convert it to a float while also placing the decimal to the left, such a

How to return a Key from HashMap based on its Value in Java

Consider the following: for (Boolean i: x.values()) { if (i == false) { return // KEY; } } In the above code, I am trying to iterate through th

how can I use if condition inside the loop in r

I defined a function creates 3 random numbers from 1 to 36, and I allowed repetition. I want to test how many times I can get three same numbers in one hand in

WooCommerce checkout: How to set field as required if another one is filled + how to autofill field with data from another field

I am looking for solution for my problems in checkout. First problem is that I need to make field company ID as required if field "Buy as company" is checked. I

I was making a simple calculator using python but I got stuck in a stage [closed]

Here this is my code, I made many mistakes here but I don't know how to fix all the errors. In this code we need to give a number as an input