1
vote
Vote UpVote

The case of a missing begin/end

The Delphi Geek – Delphi never stops surprising me …Did you know that this is a valid syntax?case a of 0: Writeln(0); else Writeln('else'); Writeln(a);end;This code indeed compiles and works exactly as the following fragment.case a of 0: Writeln(0); else begin Writeln('else'); Writeln(a); end;end;I personally would never drop begin/end inside a case/else statement, but at least someone must disagree. I found such example in a very (VERY!) old code (it was written for Delphi 2) and I was quite surprised that it compiles at all.--- Published under the Creative Commons Attribution 3.0 license
Favorite? Off-Topic? gabr42 @ 2019-07-02 19:24

Statistics

Visits: 217
Votes: 1
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Alister Christie
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)