紳士なブログ

紳士すぎてすみません

CoffeeScriptの基礎まとめ その2

今回は文字列を扱います。

s = "hello"

s = "this is a pen.
this is a panda.
this is the end"



ヒアドキュメントを使うと、こうなります。

s = "hello"

s = """this is a pen.
this is a panda.
this is the end"""



変数を展開させるためには以下のようにします。

name = "zakiyama"

alert "hi, #{name}"



数値計算もできます。

alert "hi, #{15/3}"