3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ruby 勉強メモ(変数&関数)

Posted at

概要

今回はプログラミングでは特に基本となる、変数と関数について学習したメモを忘備録として以下に記す。

変数


a = 'hello' # ローカル変数
A = 'world' # 定数
$global = 'ruby' #グローバル変数

ローカル変数なら小文字、定数ならすべて大文字で宣言する(慣習)。
またグローバル変数なら変数前に$を入れる

関数


def func(argument)
   puts argument

a = 'hello world'
func(a)
>>> hello world

関数については書き方がPythonに非常に似ているため馴染みやすかった

参考

3
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
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?