LoginSignup
0
0

More than 3 years have passed since last update.

個人的用メモ Progate Ruby Ⅰ(1)

Posted at

●Rubyとは?

まつもとゆきひろ氏により開発されたオブジェクト指向スクリプト言語。WEBアプリの「システム」を構築するためのプログラミング言語。

類似言語:PHP, Python

1.Rubyの実行

>_コンソール

Hello あざらし 

・コンソール…入出力装置

2.Rubyの基本と文字列

puts "Hello あざらし"

・命令「putsの後の値を出力せよ」

*文字列は必ずシングルかダブルクォーテーション
※ #=その行がコメント(灰色で表示)

3.数値と足し算・引き算

[注意]

・数値はクォーテーションで囲まない
・文字列と数値は別

 5 + 2 =7     ← (数値)
"5 + 2"       ← (文字列)

4.様々な計算

● Addition(+)
● subtraction(-)
● multiplication(/)
● division(%)

5.文字列と数値の連結

puts "あざらし" + "だよ" 
>_コンソール

あざらしだよ 

⇒文字列同士に+記号を用いると、
文字列同士を連結できる。

※数値の場合も同様

puts  3 + 5  → 8  (数値)
puts "3"+"5" →35 (文字列)      
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