Computed Field ‘Technique’

I’m currently reading Mark Elliot’s “Lotus Notes Developer’s Toolbox” and I’ve noticed that Mark consistently uses a technique I don’t fully understand. Here’s an example:

Mark is designing a form with a Computed, Date/Time field that is named Updated. It’s value is set to:

value:= @If(@IsDocBeingEdited; @Now; Updated);

value

Why is this done (or what are the benefits of using this approach) rather than just setting the computed field’s value to:

@If(@IsDocBeingEdited; @Now; Updated)

Subject: RE: Computed Field ‘Technique’

Functionally they are the same. It is inefficient to create a temporary variable needlessly. The way you suggested is better in that sense.

For purposes of instruction, some developers may be freaked out at first by the notion of @If returning a value. They think of it more as a logical construction of executing a statement conditionally. The use of a temporary variable here emphasizes that @If returns a value, and it is that value we are treating as the “result” of the if. Thus, beginning developers accustomed to more procedural languages may find this construction less puzzling.

Subject: Computed Field ‘Technique’

Thanks guys for taking the time to help!

Subject: Computed Field ‘Technique’

Both methods have the same effect. This looks like an individual’s coding/formula habit to me.