Bug 20255 - Simple Loop Labeling

Mark Wieder ahsoftware at sonic.net
Thu Aug 10 21:54:43 EDT 2017


On 08/10/2017 06:40 PM, Monte Goulding via use-livecode wrote:
> 
>> On 11 Aug 2017, at 11:38 am, Mark Wieder via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> I would actually argue against this. For me, the useful part would be
>>
>> end if # some complicated condition
>>
>> Otherwise, making the user come up with a comment that basically says "some complicated condition" anyway, and doing all the maintentance you've described above sounds like a lot of work for very little gain.
> 
> OK but:
> 
> if some complicated condition then
> 
> else if some other complicated condition then
> 
> else if some yet again complicated condition then
> 
> else
> 
> end if # what do you put here?

I would code that as

switch someRelatedVariable
   case someComplicatedCondition
     break
   case someOtherComplicatedCondition
     break
   case someYetAgainComplicatedCondition
     break
   default
end switch -- someRelatedVariable

<g>

but otherwise, I assume the 'end if' is attached to the 'if' and use 
that condition as the comment. The whole point of this isn't to create 
useless comments, but to ensure that a large structure can still be 
parsed visually. By the time I get to an 'end if' statement a few 
screens down I'll want to know what the original 'if' statement was, and 
with two spaces of indentation that's often hard to grok.

What would you put as a comment after the 'end if' using your proposed 
approach? The original comment for the 'if' statement or something else? 
Would you force the user to create comments for each 'else if' as well?

-- 
  Mark Wieder
  ahsoftware at gmail.com




More information about the Use-livecode mailing list