0

I want to display an output with Test = 0 using Fortran, I tried to use:

'WRITE(11,*) 'Test =' testdata'

Assuming 11 is correct and testdata is a parameter that is being calculated.

I wasn't able to get the output and there was an error.

Anyone have any idea why it is so?

1 Answer 1

4

Try inserting a comma and deleting the apostrophes:

WRITE(11,*) 'Test =', testdata

If you had reported what the error message you saw was I might have made this answer more apposite.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks! I was able to get the output with that! :)
Just one more question will be, if i want to display another data but on the same line, how will it be done? As in 'Test =', testdata, 'Test2 =', testdata2
@user1204868, just place futher data that you want to display on the same line (or within the same record as per Fortran's terminology) in the WRITE statement, separated by commas. Keep in mind that code lines in Fortran cannot be arbitrary long as in some other languages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.