Difference between double and single quotation marks in fortran?

我的未来我决定 提交于 2019-11-26 17:23:50

问题


I'm just starting out on Fortran and am confused with the usage of double vs single quotation marks.


回答1:


They are equivalent. There is no difference in their usage.

You can employ this to print one of the quotation characters:

print *, "'"

print *, '"'

prints first ' and then ".

Note: You can also use two quote characters in a row to print one:

print *, """"

print *, ''''

prints first " and then '.




回答2:


Functionally they have no difference. Just try to be consistent about which one you use. If your strings tend to have double quotes in them, use single quotes everywhere; if you use single quotes more often, use double quotes to delimit your strings.

As an additional note, it is possible to escape the quote character inside a string: (i.e. 'You\'re') but most people would suggest using it doubled up as they would find it more readable (i.e. 'You''re').



来源:https://stackoverflow.com/questions/30997887/difference-between-double-and-single-quotation-marks-in-fortran

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!