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

F# wrapping statements in a do block

I have a question regarding conventions on using do blocks in F#. Primarily this comes up when working with the .NET library classes and other .NET code. Let me give you an example. 1. With a do block wrapped around statements: let drawHelloName…
Overly Excessive
  • 2,095
  • 16
  • 31
3
votes
1 answer

Java JDBC/SQLite: Export tables to sql statements

I'm currently working with a SQLite database in java. But I would like to export all the tables and their data to SQL statements. I've tried using: "SELECT * FROM TABLENAMES INTO OUTFILE '...' But that gives me an error: " near "INTO": syntax…
Rick
  • 91
  • 8
3
votes
2 answers

Labeled while loops in Javascript

My confusion stems from this example labelled statement: myLoop : while (expression) { continue myLoop; } and the syntax of a general labelled statement: identifier : statement What exactly is being labelled in the example? isn't the whole…
Fawkes5
  • 1,001
  • 3
  • 9
  • 12
2
votes
2 answers

How to access variables inside regex statements? c# 4.0

I have looked everywhere, but I cannot for the life of me figure out how to make a variable inside a regex statement be accessible from elsewhere. If someone could help that would be amazing! Here is the code: string strRegex = @"(regexstring)"; …
2
votes
2 answers

Does an expression exist such that <> == <> is always false?

I'm not an expert on Haskell. And this question is not exactly a Haskell question, but I know Haskell people would have a better understanding of what I'm trying to achieve. So I'm building a dynamic language and I want it to be pure... Totally…
caeus
  • 3,084
  • 1
  • 22
  • 36
2
votes
1 answer

Find if the current statement in an If/Else block is the last statement of the THEN branch

I am using JavaParser to parse through the contents of the following code and identify the sequence of statements: class X { void x() { int x = 1; if (x>4) { x=21; } else { if (x>1) { x=3; } else…
John Stef
  • 585
  • 1
  • 4
  • 16
2
votes
4 answers

Transforming if-else into switch case throws error [Java]

I tried to convert my if-else statements into a switch case but I had the following problem. Old code: if (properties.get("database").toString().equalsIgnoreCase("SQLSERVER")) { manager = new CManagingSQLServer(); } else if…
41 72 6c
  • 1,600
  • 5
  • 19
  • 30
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
  • 5
  • 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
  • 43
  • 1
  • 7
2
votes
1 answer

Correct syntax for multiple if not + OR in Jinja2 if statement

I want to do X if my asnitem.asn is neither one of the values I gave. What I thought would work: {%- if not asnitem.asn == 45102 or if not asnitem.asn == 24429 or if not asnitem.asn == 132203 %} But that just gives me a syntax error. So I also…
smaxx1337
  • 136
  • 2
  • 9
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,980
  • 11
  • 83
  • 193
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
  • 69
  • 1
  • 5
1 2
3
31 32