スポンサーサイト
上記の広告は1ヶ月以上更新のないブログに表示されています。
新しい記事を書く事で広告が消せます。
新しい記事を書く事で広告が消せます。
【広告】
#irb "note".class
=> String
#irb :note.class
=> Symbol
print "hello"
print "hello" #これはメモリを食う
print :hello
print :hello #これは、1回目の:helloと同じメモリを共用する
print "abc" + "def"
=> abcdef
print :abc + :def
=> シンタックスエラー 。゚(゚´Д`゚)゚。
print :abc.to_s + :def.to_s
=> abcdef ※String 型に変換したからです。
str1 = "HANAMOGERA"
print "tamorino#{str1}"
=> tamorinoHANAMOGERA
print 'tamorino#{str1}'
=> tamorino#{str1}
print :tamorino#{str1}
=> tamorino ※シャープ#から後ろは、コメントアウト扱いになる
【広告】
文字列の中で変数の値を展開できますよ。