I have found this weird statement in a piece of code:
read(10, *) ((matrix(i, j), i=1, n), j=m, 1, -1)
I am wondering how this inline recursive reading works. What is the meaning of
((matrix(i, j), i=1, n), j=m, 1, -1)?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is not an in-line recursive read (not sure where you got this term from), this is an example of a nested implied do loop, see here, for example, for the syntax of an implied do loop and many examples of these in action. Basically an implied do loop is a way to write a do loop on a single line. With nested implied do loops you can write multiple do loops on a single line.
In your case, what you have is equivalent to (someone please correct me here if there there are any differences the OP should be aware of) something like (notice that I have unravelled the implied do loop from the outer loop inwards):