[Ruby] Ruby basics

1 minute read

Nice to meet you. Takumi. We started to improve our ability as an engineer. Thank you.

What is Ruby? Before that, here, learn what programming is, and the meaning of basic terms.

programming The data that summarizes the procedure of the process executed by the computer is called a program, The work of creating and writing this program is called programming.

Programming language A language used for programming. On the other hand, the language that we humans use in everyday conversation is called natural language.

Natural languages such as Japanese and English are for humans to communicate with each other, A programming language is a language for humans to ask a computer to process it.

Ruby (programming language) Ruby is a programming language. The description is simple and easy to understand, so programming is easy and fun, and practical. You can create a wide variety of software, from large web applications to small programs.

→ Ruby official site https://www.ruby-lang.org/ja/

Ruby program execution procedure

  1. Create a file
  2. Write the program in a file
  3. Specify the file and execute the program

To output Hello World with ruby, write it in VScode like this.

ruby/helloworld.rb


1 puts "Hello World"

In the terminal, write like this.

# Check current directory
% pwd
/Users/username/ruby

# Check the contents of the directory
% ls
helloworld.rb

# Run Ruby file
% ruby helloworld.rb

The following is the screen executed.

[email protected] ~ %cd ruby
[email protected] ruby %pwd
/Users/takumi/ruby
[email protected] ruby %ls
helloworld.rb
[email protected] ruby %ruby helloworld.rb
Hello World

that’s all. We will continue! Thank you for reading.

Tags:

Updated: