Is it possible to exit a contract?

Ali Çehreli acehreli at yahoo.com
Thu Mar 22 16:22:04 UTC 2018


On 03/22/2018 06:16 AM, berni wrote:
> Part of my code looks like this:
> 
>> out (result)
>> {
>>   if (result==true)
>>   {
>>     lots of assertions...
>>   }
>> }
> 
> I would prefer an early exit like:
> 
>> out (result)
>> {
>>   if (result==false) return;
>>
>>   lots of assertions...
>> }
> 
> Is this possible somehow (return and break don't do the job...). The 
> only thing I found is using goto, which I prefer over that gigantic 
> if-block, but maybe there is something better, I don't know of?

Never thought of it before. :) I would put all that code into a function 
and call from the out block.

Ali



More information about the Digitalmars-d-learn mailing list