× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Lurton Keel wrote:
I haven't been following the /free discussion much but is there or are there
plans to adopt multiple assignments in one /free statement?

a=b=c=d=e=f=g=h=*zero;
k=l=m=n=*blanks;

No. The statements you list actually compile today, but it doesn't mean multiple assignment. The left-most '=' is the assignment operator. The rest are the equality comparison operator.


Of course, that does not preclude the possibility of multiple target assignment in the future. It just means that a different syntax would have to be used. For example, something like, say, "a,b,c=0;" would not cause any existing code to work differently.

As an aside, many programming languages differentiate between the two, with '=' and '==' operators in many commonly used languages (like C, Python, Java, Perl, etc.), or ':=' and '=' in others (like Pascal, Modula2, ADA, etc.). RPG IV syntax was influenced by the PL/I family of languages, which uses '=' for both operations.

Having distinct operators allows assignment to be treated as an expression in some languages. But in those particular languages, the practice of coding assignments as expressions is generally discouraged since it is a common source of bugs. On the other hand, in those languages where assignment cannot be coded as an expression, having two operators emphasizes that assignment and comparison are two completely different operations.

Cheers! Hans



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.