-2

Is there a term or some short wording to refer to an expression in the "first" line of the control flow statement?

func() {
  if (a == b) {
    var = 1 + 1
    return True
  } else {
    var = 5 + 5
    return False
  }
}
if ((a == b)
 && (c == d)) {
  ...
}

In the first example, the term/wording should "match" a == b, True, and False. It should not match 1 + 1 and 5 + 5.

In the second example, it should match (a == b) && (c == d).

I used to use "control flow statement expression", but I do not think this term is accurate.

  • 1
    boolean expression? – George Barwood Jun 27 '20 at 10:05
  • 1
    Are you referring perhaps to the condition or the test? – Steve Jun 27 '20 at 11:23
  • 1
    Just thinking about more complex cases as well. The header of the switch statement would probably be formally called the comparand (and the matching blocks the cases). A for loop is typically considered to be a complex compound statement - individually you could refer to the initialiser, test, and stepping - but with all three as a unit you might call it the control section or the controls (as in, "the control section of the for loop" or "the controls have been modified on the for loop"). – Steve Jun 27 '20 at 11:34
  • 1
    I'm not quite sure what you mean by "matching true and false". Those statements do not fall in the "first line of the control flow statement", which is the element about which you asked for names/wording. Is there any significance to the fact that these statements all evaluate to a boolean type? – Steve Jun 27 '20 at 11:38
  • 1
    I'm still not really understanding what you mean by "hence, the term should match True in return True". What exactly does it mean for this undiscovered term to "match true"? By "match", do you mean the term is suitable to describe an expression (or some element of a statement) which evaluates to true (or to false)? Or do you mean something else (since we have already ruled out "boolean expression")? (1/2) – Steve Jun 27 '20 at 20:09
1

I don't know of a single term which exactly match your criteria. Your criteria seem rather arbitrary anyway since the condition in an if statement affect control flow, while a return value does not affect control flow (even though the return statement does).

Also the "first line" criteria is a bit arbitrary. For example multiple languages have both

while (condition) statement;

and

do statement while (condition);

Clearly the condition have the same function in both examples despite the position.

In short, the term you are looking for would not be very useful if it existed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.