[fpc-pascal] Changing variable in conditional
Mattias Gaertner
nc-gaertnma at netcologne.de
Tue Jan 8 09:53:23 CET 2013
On Tue, 8 Jan 2013 09:44:13 +0100
Krzysztof <dibo20 at wp.pl> wrote:
> Hi,
>
> I like when Free Pascal trying to implement best practices from other
> languages. That was with increment variable using assign operator: i += 1.
> Anyway, few days ago I analyzed C++ code and I liked one syntax:
>
> if ( ( i = GetSomeValue ) >= 10 ) {
> // variable "i" already has value returned by GetSomeValue
> }
>
> I wonder if FPC has equivalent for this.
Even C has some equivalent:
i = GetSomeValue;
if ( i >= 10 ) {
// no comment needed, the value of i is obvious
}
Mattias
More information about the fpc-pascal
mailing list