what does int x=1 (x>1){x++;} mean or used for
As what, part of a for loop?
It is used within the loops or in test conditions to evaluatee x
@Ramesh1418 From the look of it, it is the start of a for loop.
yes @e.mccormick x=1;//initialization (x>1);//test condition whether inclded in loops or conditional statements x++;//used to update the value of x by 1 i.e, x=(x+1) simply written as x++
What I mean is as opposed to a loop in general. In a while loop they would do it a bit differently.
Though the construct seems kind of odd, to be honest.
yes ofcourse
@gobza95 How it would look in c++ http://www.tutorialspoint.com/cplusplus/cpp_for_loop.htm Java: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html Python: http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/loops.html You can see how similar they are. What you listed was closest to the c++ version, but one of the Java ones is also very similar. In python they are a tad different but you can see that there is some serious similarity.
Join our real-time social learning platform and learn together with your friends!