[ruby] Method call with argument

Overview

When I was creating an automatic trading tool for bitcoin, I sometimes used it with arguments, so I will record it.

Method definition

The method definition is as follows.

def method name(Variable 1,Variable 2, ...)
Process to be executed
end

Method call

The expression when calling the method looks like this:

Method name(Argument 1,Argument 2, ...)

I will actually see it

number.rb


def number(a,b)
  return a * b
end

puts number(3,4)
#Execution result will be 12

3 is called for a and 4 is called for b as the argument of the number method. As a result, 3x4 is executed and 12 is output.

Recommended Posts

[ruby] Method call with argument
Integer check method with ruby
Ruby to_s method
[Ruby] slice method
[Ruby] Method memorandum
[Ruby] initialize method
Ruby build method
Ruby accessor method
ruby map method
[Android] Call Kotlin's default argument method from Java
[Ruby] Exclude duplicate elements with the uniq method.
Check method call arguments in blocks with RSpec
Finding pi with the Monte Carlo method? (Ruby)
Install Ruby 3.0.0 with asdf
Ruby Learning # 30 Initialize Method
abbreviation for ruby method
Ruby Learning # 24 Exponent Method
Ruby Thread # [] = method notes
definition of ruby method
11th, Classification with Ruby
[Ruby] Method definition summary
Call a method with a Kotlin callback block from Java
Prevent unnecessary null checking !: Method with double type argument
Call your own method with PreAuthorize in Spring Security
Ruby version switching with rbenv
Solve Google problems with Ruby
I tried DI with Ruby
GraphQL Client starting with Ruby
Leap year judgment with Ruby
Format Ruby with VS Code
Ruby algorithm (inject, method definition)
Various method tests with MockRestServiceServer
Ruby Learning # 8 Working With String
[Ruby] Notes on gets method
[Ruby] problem with if statement
[Ruby] Method that returns truth
Studying with CodeWar (ruby) ⑤ proc
Conditional branch with helper method
Getting Started with Ruby Modules
[Ruby] Specify the argument name of the method. Meaning of the colon (:) at the end
Ruby design pattern template method pattern memo
Simulate the simplex method with GUI
[Ruby] Method to count specific characters
Ruby Scraping-Move Selenium Headless with VPS.
[Java] Object-oriented syntax --class method / argument
Learning Ruby with AtCoder 6 [Contest 168 Therefore]
[Ruby] present/blank method and postfix if.
Let's use Amazon Textract with Ruby
Programming with ruby (on the way)
Studying with CodeWar (ruby) ④ case ~ when
Introduction to algorithms with java-Shakutori method
[Ruby basics] split method and to_s method
[Ruby] How to use any? Method
String output method memo in Ruby
Handle DatePicker with Ruby / gtk3 + glade3
[Ruby] Yield but no block argument
Impressions of making BlackJack-cli with Ruby
[Ruby] Search problem using index method
[Ruby on Rails] Convenient helper method
[Ruby] undefined method `dark?'occurs in rqr_code
Install ruby on Ubuntu 20.04 with rbenv