LoginSignup
0
0

More than 3 years have passed since last update.

ruby 文字を表示させる(超基礎)

Last updated at Posted at 2019-10-31
  • irb
  • ri オブジェクト名
    • オブジェクトの中身見れるよ
print "hello world" #表示
puts "hellow world" #行末に改行が含まれる
p "hello world" #デバッグ用としてオブジェストの種類が分かりやすいように表示

これを実行すると
hello worldhello world
"hello world"

と表示される

変数

  • いきなり書き始めてもいい
  • 英小文字または_から書き始める
msg = "hello world"
puts msg

実行結果:hello world

定数

  • 定数 ⇒ 書き換えたくない文字のこと
  • 英大文字から書き始める
TENKI = "晴れ"
puts TENKI

実行結果:晴れ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0