Questions tagged [statements]

In computer programming a statement is the smallest standalone element of an imperative programming language. A program written in such a language is formed by a sequence of one or more statements. A statement will have internal components (e.g., expressions).

A statement is the smallest standalone element of an imperative programming language. A program written in such a language is formed by a sequence of one or more statements. A statement will have internal components (e.g., expressions).

Resources

471 questions
-2
votes
1 answer

Python Can't understand conditional statement in loop

Need help in python. This code is from leetcode.com, one of the solutions for this problem and cannot understand conditional statement there, exactly the code "stack[-1][1]" class Solution(object): def dailyTemperatures(self, temps): if not…
Almaz
  • 51
  • 1
  • 6
-2
votes
1 answer

Getting range between two wildcards T-sql query syntax

I have a decimal column that i need to to run a wildcard query on in a case statement but the wildcards will need a between clause that is between one wildcard to another e.g case when pct between '999.0%' and '700.0%' then 'Top percentile' how do…
Spinx
  • 1
  • 5
-2
votes
3 answers

Missing return statement when trying to return a boolean value

I keep getting an error in java and I don't know why "missing return statement". What I'm trying to do is create a method with two parameters (String and char) check if the char appears in the string and return a boolean value based on the…
CSJerry
  • 13
  • 1
  • 6
-2
votes
1 answer

Displaying hidden text using PHP

I am trying to come up with a php if statement for my site. I have a page called "research". There is text on this page with a link which says "contact me" This link links through to my contact page. Now, I need an if statement to say that if you…
Wizard
  • 31
  • 6
-2
votes
1 answer

If statements running simultaneously, if two objects in ArrayList

Below is the code. I cannot figure out why in class Database my else if the state runs simultaneously with my if statement IF I have entered the second bird into the ArrayList. please, any help would be appreciated! public class Main { public…
Dyeh310
  • 5
  • 2
-2
votes
2 answers

Multiple if Statements issue

I am having a problem with multiple if statements. I am using && but it seems to only work for the first statement. The code is like such: global $post; $args = array( 'post_id' => $post->ID ); $comment = get_comments( $args ); $user =…
David
  • 1
-2
votes
2 answers

Truncated If Statement C++ (Turning letters to numbers)

I am trying to change a series of letters into numbers with C++ and have started by making this code. However, it appears that the math that calculates the digit1 variable is never getting executed. Any thoughts? #include #include…
Lucas
  • 5
  • 1
-2
votes
1 answer

JAVA: What is the difference between a logical AND/OR and short circuit AND/OR?

When I run a simple program, both of them ( & and && ) seem to work interchangeably. Could someone please explain when I should use each case? public class Test1 { public static void main(String [] args){ int counter = 0; …
-2
votes
2 answers

How would I turn this into a prepared statement?

I'm new to prepared statements so I apologise in advance if this is a basic question but how would I turn the following code into a prepared statement and execute it later on?
-2
votes
2 answers

statements and variables with first comma

The prompt: Write a sequence of statements that finds the first comma in the string associated with the variable line, and associates the variable clause the portion of line up to, but not including the comma. I am stuck. All I could understand…
Paul Bernella
  • 31
  • 1
  • 4
  • 13
-2
votes
2 answers

Finding maximum and minimum in inteval using dynamic memory allocation C program

Hello i am trying to find the maximum and minimum in a given interval using dynamic arrays. It works to find the maximum and minimum, but not in the given number interval. Where am i going wrong ? Please help. #ifdef _MSC_VER #define…
-2
votes
2 answers

Structuring if statements properly

I'm in a intro to C programming class, and I'm working on a homework assignment. I just can't get to work properly. This is the homework assignment: When someone buys a small number of widgets, they pay normal price. When someone buys a medium…
staringblind
  • 7
  • 1
  • 3
-2
votes
4 answers

Where is my code going wrong?

EDIT: I think I copied slightly wrong code! public class GradeCalculator { public static void calculateGrade(int mark) { if (mark >= 70) System.out.println("grade = A"); if (mark >= 60) System.out.println("grade = B"); if (mark >= 50)…
mark e
  • 1
  • 1
-2
votes
1 answer

SQL Alter an value from 1 to 0

Hey im looking for a SQL statement that let me alters the int in the database to a zero for inactive - i have no idea how to write the SQL query like that,and how the php code would look. This is my best guess.. select id,active from posts where…
-2
votes
3 answers

Difficulty using else statements in Java

import java.util.Scanner; public class ShopSystem { public static void main (String [] args) { String plyrRace; int plyrRaceI; System.out.println("What is your race?"); System.out.println("Orc"); System.out.println("Elf"); …