双引号和单引号 [英] Double vs single quotes

查看:57
本文介绍了双引号和单引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Ruby 真的很陌生,我想知道是否有特定的时间我应该使用 ""''.

I'm really new to Ruby and I'm trying to understand if there's a specific time when I should use "" vs ''.

我大部分时间都在使用单引号,因为它更容易输入,但我不确定是否应该使用.

I've been using single quotes most of the time because it's easier to type but I'm not sure if I should.

例如获取用户/新" vs 获取用户/新"

推荐答案

" " 允许您进行字符串插值,例如:

" " allows you to do string interpolation, e.g.:

world_type = 'Mars'
"Hello #{world_type}"

这篇关于双引号和单引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆