-
Notifications
You must be signed in to change notification settings - Fork 448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comparison operators =
, >
, >=
, <
, >=
, <>
or EQ
, GT
, GE
, LT
, LE
, NE
#282
Comments
I thought the 2 letter based comparison operators with equivalents might have been considered obsolete by now. Then it would have been covered by Avoid obsolete language elements. That is not the case though. Probably also because of range tables where you need to know these in any case. The recommendation in the 7.56 keyword documentation just says you should pick either one but be consistent.
I personally would be in favor for using This did remind me of the remark in Don't chain assignments though regarding the multiple uses of |
Thanks @fabianlupa that is a great explanation. I'm also in favor of using |
=,<,>,<>
or EQ,GT,LT,NE
=
, >
, >=
, <
, >=
, <>
or EQ
, GT
, GE
, LT
, LE
, NE
I'd leave the issue open though, maybe there's a consensus that the guide should include a chapter on this topic. |
Therefore i would see =,< and > as a recommendation except you need to mix it with CO, CN,.. |
Personally, I do not consider overloading an issue in a language where whitespace is significant. I vote for recommending the non-character-based operators whenever available. |
I also vote for symbols instead of characters. In addition to what's mentioned already, characters are based on English language, so especially for non-native speakers it takes an extra millisecond to translate GE to "greater or equals" while >= is a universal symbol that doesn't require translation overhead. |
Good point. Symbols like |
Just because symbol operators are used in many other languages, I vote for them instead characters. |
Hi there, I have done a code review on legacy code today and definitely favor the symbols. Having the EQ, LT, GE in comparison to their counterparts was really throwing me off. IF current_level LT new_level OR
current_level GE old_level. vs. IF current_level < new_level OR
current_level >= old_level. The symbols (<, >=) are just much more readable imo. So yeah: I vote for <, >, = over LT, GE, EQ. |
IMO this doesn't really make sense when every single ABAP keyword is based on English language. I consider relational operators like CN or NA to be much trickier, and they don't even have an alternative form. My main concerns are:
|
Totally agree with @TheLazyHangman and the SAP docu. IMHO the consistent use is the essential point and should be enforced by the related styleguide, but in case of ABAP not what type is being used. If the SAP would introduce '==' instead of '=' for comparison, I would prefer the symbol-based comparison. |
Does CleanABAP recommend using
=
,>
,>=
,<
,>=
,<>
orEQ
,GT
,GE
,LT
,LE
,NE
when used as comparison operators?For reference see here.
I did not find anything in the documentation.
The text was updated successfully, but these errors were encountered: