+ 6
Have you heard about "down-to" operator?
Let's make it interesting! Suppose you're given a program to print all numbers from m to n. Easy, isn't it? Check out the following code which uses the "down-to" operator for this purpose: https://code.sololearn.com/c9iEFTCXyooP/#cpp But, there is something "irony" in this "down-to" operator... Can you resolve it?
15 Answers
+ 12
(a --> 1) means
((a--) > 1)
LOL!
+ 6
Hey @C++ Soldier (Babak) Nice!
You found the "irony" ;)
+ 6
@rv7 I thought you were using mobile app too, it's fine though, still waiting for the next prank :D
+ 5
I had no idea that existed,New trick acquired...thanks for uploading
+ 5
@Sai welcome! Even I myself had no idea.
Actually, it's not just in C++ only, it's also in Java, JS and other popular languages, EXCEPT Python...
Can you guess why?
+ 5
😀Good joke. The irony is this "operator" actually down-to to 0, not 1
+ 5
@Sai Actually the "-->" thing isn't actually an operator.
It's a combo of "--" and ">".
Line 8th in my code can be illustrated as:
} while ( (a--) > 1 );
And, the loop will runs until a equals 1, i.e., "a goes to 1" ;)
This is the reason why there is no docs on this operator in any language. LOL!
+ 5
@KrOW how about x ++< 10, "upto" operator?
+ 5
rv7 This is less funny 😀😀😀
+ 5
I'll be waiting for your next prank, but please, next time do it right in a feed post ... LOL, nice one ... XD
+ 4
Nice meta-operator 😁😁😁😁
+ 4
@Ipang Thanks! And you're right about the feeds, and I believe you can understand the condition of www.sololearn.com. No feed to feed ;)
+ 4
@Ipang Glad to know that. Cheers!
+ 3
I can't say,care to enlighten me rv7
+ 1
I am heard downto() function in kotlin for loop
for ( a in 10.downTo(1))
I think this is vaid
then the look will
the Ranges 10 ..1