Since qiita often uses Markdown, I will leave the qiita article below for notes. Markdown Writing Cheat Sheet
Convention over Configuration
This time, shebang was explained.
What is a shebang? shebang is the first line of a UNIX script that starts with #! And specifies the interpreter to start and load the script.
If the path is set, it can be converted into a command, and the program can be handled conveniently.
With this setting, programs under ~ / bin can be easily used if you have execute permission! !!
Use the chmod command for execution privileges. You can check the contents with man chmod </ strong>.
Ruby handles if-else statements as follows
if expression[then] formula... [elsif expression[then] formula... ] ... [else formula... ] end
Class review 1
--How to handle if-else statements in ruby
p year = ARGV.to_i # .to_i is a method to convert to int type if year % 4 == 0 p true end
Class review 2
--How to handle arrays and loop statements in ruby
[2004, 1999].each do |year| # Array (same as python list) #Extract elements in order with each method p year if year%4 == 0 p true else p false end end
Class review 3
--More detailed loop statement
[1900,2004,1999].each do |year| p year #The first if statement if year % 100 ==0 p false next #next is the same as the python continue statement end #Second if statement if year % 4 == 0 p true else p false end end