Forum > General

Inline If statement, i.e. IIF()?

<< < (5/5)

PascalDragon:

--- Quote from: MarkMLl on May 23, 2024, 08:42:27 am ---
--- Quote from: PascalDragon on May 22, 2024, 09:28:29 pm ---
--- Quote from: MarkMLl on May 22, 2024, 08:36:04 am ---I'm a bit troubled though: if the syntax "looks like a function", how is it possible to know that it's the "evaluate one but not both" wgich is being used rather than the "ordinary function" from strutils or maths?

--- End quote ---

If I'd do it again I'd just go with a if … then … else-expression. 🤷‍♀️

--- End quote ---

Which was of course the ALGOL way. In the general case (i.e. including later ALGOL derivatives), I've been troubled by that lacking an explicit end. However since it can't- by definition- omit the else I think that in terms of language consistency this is a a very minor sin.
--- End quote ---

That is my opinion as well that the “dangling else” problem isn't as problematic with the if-expression compared to the if-statement.

Navigation

[0] Message Index

[*] Previous page

Go to full version