+ 2

How do operators methods work?

I recently discovered that operators like <, *, - and similar are methods whose arguments are the left and right values. However, I researched and did not find any information on how they work. For example, would the + method would not have to use itself to return a value? If so, how could that be? Would not it cause an infinite loop in which the operator calls himself trying to figure out what he does himself? Sorry for my english. :x

16th Apr 2018, 10:39 PM
rfPeixoto
rfPeixoto - avatar
2 Respostas
+ 1
Here's some demonstration code for adding matrices: https://code.sololearn.com/crQLZ2gdruDZ/#cs Hopefully you can adapt that for - and * etc?
16th Apr 2018, 11:11 PM
Emma
+ 2
How fast! Thank you so much, I can understand that much better now.
16th Apr 2018, 11:20 PM
rfPeixoto
rfPeixoto - avatar