This time, as a memorandum, I will write a memo that I learned about variables and functions, which is especially basic in programming.
a = 'hello' #Local variables
A = 'world' #constant
$global = 'ruby' #Global variables
Declare local variables in lowercase and constants in all uppercase (custom). If it is a global variable, put $ before the variable.
def func(argument)
puts argument
a = 'hello world'
func(a)
>>> hello world
The function was easy to get used to because it was written very similar to Python.
https://www.sejuku.net/blog/12879
Recommended Posts