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

458 questions
2
votes
2 answers

understanding the use of javascript statements

This question is not meant to find a solution for the task but to understand as the title says. I could not categorize the question. Without further ado. I began practicing Javascript on the website freecodecamp.org.My main concern is the set up of…
A-L
  • 57
  • 1
  • 7
2
votes
4 answers

I dont understand y---3 statement

Why y---3 statement behave like y = 3 ? Can someone explain? #include main(){ int x=-2, y=4, z; y---3; printf("%d",y); }
2
votes
5 answers

How can I remove one of these if statements and shorten the code?

I have the following code. The only problem is that we run it through a checkstyle program and it comes up with the error Cyclomatic Complexity is 11 (max allowed is 10). I would like to know how can remove one of the if statement to make it do the…
ron8
  • 243
  • 2
  • 4
  • 13
2
votes
2 answers

Is it possible to declare user-defined statements in python (same syntax of assert)?

For example, what assert does: assert , What I would like to do: mycommand , It would…
quan2m
  • 23
  • 1
  • 7
2
votes
2 answers

R: Subset from two data frames based on multiple conditions

I have two dataframes (df1 and df2), and I want a new dataframe (df3) containing all rows where "date" AND "time_of_day" of df1 match with df2. And save the rows of df1 that don't match as well in a new dataframe (df4). I tried using dplyr filter…
2
votes
2 answers

How to set the flag true/false based on field values?

I have multiple records that have type and status. In case where record type is 'DEV' then the status should be checked. In that case if status is 'Y' then variable should be set to true. Here is example of few records: RecID Type Status 1 …
espresso_coffee
  • 5,076
  • 9
  • 53
  • 124
2
votes
2 answers

Adding elif statement into generator notation

I´m trying to implement generator notation into my code, specifically into my str() method. This is what I have so far and now I need to add "elif" statement there, but not sure how to type it into this generator notation. Can you help? def…
fin1010
  • 39
  • 4
2
votes
7 answers

Javascript reads only first elements(from array) in nested for loops

I have the following issue. There's a problem I have to solve. Fruit or Vegetable Write a JS function to print "fruit" , "vegetable" or "unknown" depending on the input string. Fruits are: banana, apple, kiwi, cherry, lemon, grapes,…
Nasco.Chachev
  • 646
  • 6
  • 18
2
votes
4 answers

My first IF doesn't work, but my else if and else parts work javascript

I am having an issue. My first IF statement doesn't work, but my ELSE IF and my ELSE statements do work, and I can't figure out why. (function(){ var dateHeure = new Date().getHours(); var dateHeure = dateHeure.toString(); var $p =…
guiguivey
  • 21
  • 4
2
votes
3 answers

Multiple conditions vs. multiple statements

Is there a difference in terms of performance between these code examples? if (this.game.physics.arcade.overlap(this.player, this.barels) && (this.game.time.now - this.srdicka.timecheck > this.srdicka.frequency) || (this.player.position.y >…
2
votes
2 answers

IF / ELSE statements in sql

My SQL statement: select * from categories where onair = 1 and City LIKE 's%'; First part: select * from categories where onair = 1 second part: and city like 's%'; If city column is not null, then I want to execute second part too.…
Arlong
  • 317
  • 3
  • 13
2
votes
3 answers

PHP: how to use a variable from one if statement in another

Separately the forms are ok, but combined.... not really. The struggle is that i can't access the variable $name from the first if statement in the second. Error : Undefined variable: name html:
2
votes
3 answers

What's the major difference between if statements and unless statements?

I am new to programming and I don't understand what the difference is. I am coding in Ruby.
2
votes
1 answer

Python user selected function

I am trying to make a program with functions that display five different flags. The user selects these flags from a list. My largest problem is that every flag prints, without regard to the flag I chose. I have tried to keep each part of the code…
Michael
  • 33
  • 4
2
votes
3 answers

Multiple if statements in C

Suppose I want to calculate net_salary of an employee after taking into account the number of years he's worked and the number of kids he has. I don't want to use nested if statements since that will complicate the number of checks I need to…
idnow
  • 27
  • 2
1 2
3
30 31