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
-1
votes
1 answer

If Else StatementsTraffic Light Coding Java Blue J

I basically have to code a traffic light to start at red, then red to green and back to red again. I manage to get the traffic light from flashing red to green but not vice versa, can someone look at my code and see what I have done wrong on the if…
-1
votes
1 answer

Bash case statement with number ranges

I am in need of some assistance I cannot for the life of me seem to understand bash case statements. What I'm trying to do is to get input from the user, their annual income, and reply back with their respective tax bracket. But i cannot seem to get…
yoprogrammer
  • 91
  • 1
  • 6
-1
votes
1 answer

What does the comparison statement a > b && ( b = 0) mean after a variable declaration in javascript?

I find it in other people's source code alot. for Example var y = $('some-selector'), u = $(document).scrollTop(); 0 > u && (u = 0); //mysterious line.. var w = 'another variable'; Here's another example : ! function(foo) { …
-1
votes
3 answers

Conditional instructions in swift

I am trying to write in swift something that should be very basic, but I can't seem to get a handle on it : First, I create a global variable. For example: var xx:Int Then, I want to create a conditional instruction. Something like : if (xx ==…
Glyphs
  • 97
  • 1
  • 1
  • 7
-1
votes
1 answer

I'm not sure why this JQuery String isn't working

I'm trying to do this: "If the reference in the div with the class 'cart_ref' is equal to 'MAG04WH30' then hide up and down arrows with class names 'cart_quantity_up', 'cart_quantity_down' and disable div with the class name 'cart_quantity_input'.…
-1
votes
1 answer

Why does one value keep appearing larger than the other?

So I'm trying to do this small program as a exercise for class and I honestly cannot figure out why the value for x keeps replacing w. Could someone explain to me why this is happening. I know ASCII-wise w has a smaller value than x so i genuinely…
C0C0B
  • 11
  • 2
  • 4
-1
votes
1 answer

Searching for occurence of symbol ';' and symbol '.' for every new line of a textfile

I am searching for the occurence of the';' and symbol '.' for every new line of a text file and then to divide them for every new line. I am getting weird values for the division of every new line. Is there any other way to do it ? #include…
-1
votes
1 answer

How to use two cin statement in c++

I am in doubt about how cin works with two statements, in my program I need to get at first, a sequence of numbers from the user and put them in a vector, and after a number B which will sum the first B elements of that vector, for example, if the…
DanRyu
  • 3
  • 3
-1
votes
2 answers

I dont know what to do

public MyTime nextSecond() { if(getSecond()>=0||getSecond()<=58) return new MyTime(getHour(),getMinute(),getSecond()+1); else if(getSecond()==59) return new MyTime(getHour(),getMinute(),0); else throw new…
-1
votes
3 answers

How do I create and if condition for strings in python

Hello I've been trying to get this line of code working but it keeps going down to the else: statement. Any ideas? I cant understand what I'm doing wrong for it not to accept the if: condition. print('What do you get when you cross a snowman with a…
-1
votes
1 answer

How to condense my if statement

I have been asked to create a mark to grade converter in Windows Form Application. My code below is from the click of a button. Once a user has input their mark into 'Markbox' and the button is clicked the if statement will run and it will find the…
Bal Jhand
  • 61
  • 5
-1
votes
1 answer

how to define a stored procedures which accepts 2 parameteres

I´m trying to define a stored procedures which accepts 2 parameteres , one would be the table column which has to be equal with the second parameter i will provide. Code : DELIMITER $$ CREATE DEFINER=`root`@`localhost` PROCEDURE…
alexsc
  • 1,196
  • 1
  • 11
  • 21
-1
votes
3 answers

Using PDO to avoid sql injection - new code doesn't work (newbie)

I want to use prepared statements to avoid SQL injection. To give you an idea, this was my old code:
Stan
  • 937
  • 5
  • 15
  • 33
-1
votes
3 answers

How to take multiple user inputs using if-else statements in java.

import java.util.Scanner; public class Assignment6 { public static void commandList() { System.out.println("Command Options------------"); System.out.println("a: Create a new table"); System.out.println("b: Change the row sizes"); …
mrcj1208
  • 13
  • 1
  • 2
-1
votes
4 answers

Strings in If - Else Statements in Java

I am writing a program that takes a user input and depending on their answer gives them a different answer. How do I use a string that the user entered with an if - else statement? I have this so far: import java.io.*; import static…