Forum Discussion

denioflavio's avatar
denioflavio
Occasional Contributor
12 years ago
Solved

Break procedure execution.

Hi!



I have a delphiscript coded like this:



  1. procedure test(value : boolean);


  2. begin


  3.     if (value = true)


  4.        Do Nothing


  5.    else 


  6.        Do Something  


  7. end;




But what I need to know is whether exists a statement that allow me write it in this way:



  1. procedure test(value : boolean);


  2. begin


  3.     if (value = true)


  4.        Break procedure execution


  5.     


  6.     Do Something; 


  7. end;


It´s looks like the break statement existing in while, for loops. 



Thanks!!



  • There is the Exit command in DelphiScript to break procedure / function execution.

    But the case that you described can be coded like this:



    1. procedure test(value : boolean);


    2. begin


    3.     if (value = false)


    4.        Do Something  


    5. end;


2 Replies

  • There is the Exit command in DelphiScript to break procedure / function execution.

    But the case that you described can be coded like this:



    1. procedure test(value : boolean);


    2. begin


    3.     if (value = false)


    4.        Do Something  


    5. end;


  • denioflavio's avatar
    denioflavio
    Occasional Contributor

    Thanks a LOT!!


    The EXIT command worked fine!!


     


    I´d prefer use it. Because my 'Do Something' can be so large, and I think that is a little 'weird' put a lot of things into a if block.. anyway,. The Exit works fine, thanks again!