fredoverflow
fredoverflow

Reputation: 263118

Statements and state

Is there any deeper meaning in the fact that the word "statement" starts with the word "state", or is that just a curious coincidence? Note that english is not my native language, so the answer might be obvious to you, but not me ;)

Upvotes: 1

Views: 326

Answers (4)

Wildcat
Wildcat

Reputation: 8870

The key concept of imperative programming paradigm is that programs are represented by the sequence of statements one of which change the program state.

So you change the state or you can say you actually state (declare) something with each statement. For me it seems that -ment suffix is used here in its third sense ("The means or instrument of an action"). Statements are instruments to state something in imperative program.

In universal usage it seems that -ment suffix is used in its first sense ("An action, process, or skill").

Upvotes: 0

Derrick Turk
Derrick Turk

Reputation: 4336

Etymologically, the answer is yes, as Christopher pointed out.

However, I would argue that in programming, too, there is a connection. Statements (as opposed to expressions, which are syntactic elements which may be evaluated for their value) are syntactic elements representing imperative commands. (You may hear that in C, many statements (ex. assignment) are also expressions.)

As such, statements necessarily involve some change in the state of the program (ex x := 5), or the imposition of some control flow (ex GOTO 10). You will note that a purely functional language (say, Haskell), contains no statements, but only expressions.

Upvotes: 0

Christopher Barber
Christopher Barber

Reputation: 2678

The English word "statement" does derive from the verb form of "state", but the programming terms "state" and "statement" aren't related to each other in any meaningful way. A statement in a programming language is merely a syntactic construct and does not imply that any state is involved.

Upvotes: 1

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798606

It derives from the verb sense of "state".

Upvotes: 0

Related Questions