一、字符串
1、“\”
ruby中,想要在字符串中插入特定意义的字符时,使用“\”符号,“\”后的字符会随着后面伴随的字符而带有特殊意义
eg:
①print("Hello,\"ruby\".\n")
执行结果:hello,"ruby".
②print("Hello,\\ruby.\n"
执行结果:hello,\ruby.
2、“"”与“""”
比如:单引号"并不会翻译“\n”,而会直接显示出来;但是有两个例外,想要在字符串中包含“\”与“'’”这两个字符时,前面必须加上“\”
eg:
①print ('hello,\nruby\n')
执行结果:hello,\nruby\n
②print ('hello,\'ruby\'')
执行结果:hello,'ruby'
ruby中可以print时不加()
3、“\t”等于tab