Copy link to clipboard
Copied
Just found in legacy code the following:
private var firstRect:Rectangle;
private var secondRect:Rectangle;
if (firstRect < secondRect)
{
// do something
}
How does operator 'less than' work with Rectangle objects?
Doc says that object is converted to number if it is not a String.
Rectangle is not a String, though has conversion to String.
Please help.
Copy link to clipboard
Copied
Probably the best thing to do is to try different rectangle values with different operators until you understand it.
Copy link to clipboard
Copied
Is there are a chance to know for sure how it works instead of bruteforce rectangles?
Copy link to clipboard
Copied
IME the best way to know for sure is to experiment. The docs are only one person's best understanding of how things worked on the day, which is seldom 100% accurate. I find that even with code I wrote I can't accurately say 100% of what it does until I've worked with it for a while. Keep in mind that the docs are usually written when the code is written, so never expect more than a rough idea from the docs.