Question Block

Hello guys I am just a beginner.

I saw this line of code in the system.

Code:
buyer-acct:

Simply as that..Anyway, it is not a function, method, procedure and also not defined as variable.
I think its something related to block? I just want to ask what is the use of this.

And in every assignments I saw Next buyer-acct.



And for follow up question...Is there a way to easily find the 'End' of a particular block?.

Any reply is so much appreciated :)
 

davidvilla

Member
this sample program can explain you better

Here, I have two repeat blocks and I am controlling them using the labels labels "main-block" and "sub-block"

Code:
define variable cVar as character format "x(1)" no-undo.
main-block:
repeat:
    sub-block:
    repeat:
        update cVar.
        message "one" view-as alert-box.
        if cVar = "Q" then do:
            message "leave main-block" view-as alert-box.
            leave main-block.
        end.
        else if cVar = "E" then do:
            message "leave sub-block" view-as alert-box.
            leave sub-block.
        end.
        else next sub-block.
    end. /* sub-block */
    message "two" view-as alert-box.
end. /* main-block */
message "three" view-as alert-box.
 

GregTomkins

Active Member
There's no way that I know of. It's common in our shop to add the comment. It's also common that the comment doesn't match the reality, which is why I don't like that approach. But many do!
 

Cringer

ProgressTalk.com Moderator
Staff member
The only way to identify the end of a code block with any certainty is to look at the compile with listings. But that's not really too practical in most cases. As others have said it is often marked with a comment by a developer.
 

andre42

Member
The label has to be placed directly in front of the statement which starts the block (eg. do:, for ...: or repeat: ) so it is just a matter of find the statement which ends the block, just like when there is no label.
PDSOE also highlights the complementary statement when you place the cursor on the starting or ending statement. You can also use Shift-Ctrl-P or use Navigate/Go to Matching Bracket to jump to the complementary statement. Sometimes PDSOE is mistaken when it parses the code differently from the compiler, though. (Especially happens when includes are used.)
 
Top