[RUBY] A note about the scope

For the processing of def ~ end If there is a number you want to pass from outside the process appear.

Declare what variable you want to pass first, Just add the variable you want to pass to the variable you receive.

[Scope occurrence example]

def show_review
    line = "---------------------------"
    puts "Genre: #{genre}\n#{line}\n"
    puts "title: #{title}\n#{line}\n"
    puts "Impressions:\n#{impression}\n#{line}\n"

genre = "aaa"
title = "qqq"
impression = "ddd"

① In "genre" "title" "impression" in "review.show_review" Pass the value ② An error occurs in the scope ③ Add (genre, title, impression) to "review.show_review" ④ In addition, add (genre, title, impression) to the handed side as well. ⑤ You can hand it over! !!

def show_review (genre,title,impression)← ② Add recipients
    line = "---------------------------"
    puts "Genre: #{genre}\n#{line}\n"
    puts "title: #{title}\n#{line}\n"
    puts "Impressions:\n#{impression}\n#{line}\n"

genre = "aaa"
title = "qqq"
impression = "ddd" 
review.show_review(genre,title,impression)← ① Add the item you want to pass

Recommended Posts

A note about the scope
A note about the Rails and Vue process
A note about Java GC
A private note about AtomicReference
About scope
A note about RocksDB's Column Families
A murmur about the utility class
A note about the seed function of Ruby on Rails
A review note for the class java.util.Scanner
[Swift] A note about function and closure
A note on the libGDX Utils class
[Note] About nil
About the method
A review note for the class java.util.Optional
A review note for the class java.util.Objects
About the package
A rudimentary note on the Fibonacci sequence
A review note for the package java.time.temporal
A note about adding Junit 4 to Android Studio
A story about the JDK in the Java 11 era
A note when the heroku command becomes unavailable
A story about making a Builder that inherits the Builder
[Note] About the introduction to Swift practice Chapter 11
Output about the method # 2
About the StringBuilder class
Commentary: About the interface
Q & A about JDK
About the asset pipeline
About the function double-java
About the ternary operator
About the length method
About the Kernel module
About the authenticate method.
About the map method
About the ancestors method
[Output] About the database
About the [ruby] operator
About the to_s method.
Master the [Rails] scope!
I read the readable code, so make a note
A rough note about Ruby arrays and hash objects
A note for Initializing Fields in the Java tutorial
A note about th: field th: each th: object of thymeleaf
A story about introducing Evolutions into the Play Framework
A review note of the Spring Framework Resource interface
I learned about the existence of a gemspec file
About the handling of Null
About specifying the JAXRS path
about the where method (rails)
About the description of Docker-compose.yml
About the File :: Stat class
Pass a variable to Scope.
A note when examining Javalin
I tried JAX-RS and made a note of the procedure
About the same and equivalent
About the Android life cycle
[Note] About the Fizz_Buzz problem (How Ruby on Rails works)
About the explanation about functional type
About the behavior when doing a file map with java
About the programming language Crystal
Consideration about the times method