1

Some programming languages allow conditional value assignments that look like

  x = (IF condition THEN a ELSE b)

My search-fu is failing me: how do we call such statements in the jargon of programming languages?

It evokes functional programming, though some imperative languages achieve the same with a "ternary operator". In order to find relevant documentation for my favorite languages, I would really love to know the proper vocabulary!

Thanks a lot

Deleplace
  • 143
  • 1

2 Answers2

1

My search-fu is failing me: how do we call such statements in the jargon of programming languages?

We don't. It's an expression, not a statement. If it were a statement, it wouldn't have a value. (Unless by "such statements" you are referring to the assignment?)

In order to find relevant documentation for my favorite languages, I would really love to know the proper vocabulary!

You will have to look at the documentation for your favorite languages, then. Different language communities come up with different terms for pretty much everything. (E.g. "member function" in C++, "method" in Java, and "routine" in Eiffel are all the same thing whereas "method" in Java and "method" in CLU are different things, and "function" in C and "function" in Pascal are different things.)

Jörg W Mittag
  • 104,619
-2

I'm a full-time functional programmer, and have usually heard it called simply "an if expression," as opposed to an if statement. Expressions return values whereas statements are executed for their side effects.

Unfortunately, imperative programmers often use "expression" and "statement" almost interchangeably, so it's probably not a universally recognized term.

Karl Bielefeldt
  • 148,830