Skip to content

Commit

Permalink
Introduce inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaliniR8 committed Dec 12, 2024
1 parent 6efba34 commit a51eb67
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ruby.md
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,9 @@ dwight.name #=> "Dwight K. Schrute"
# Calling of a class method
Human.say('Hi') #=> "Hi"

# Tip: Use .inspect to see instance with instance variables
puts jim.inspect #=> #<Human:0x000058b3c7f0c7a0 @name="Jim Halpert", @age=0>

# Variable's scopes are defined by the way we name them.
# Variables that start with $ have global scope.
$var = "I'm a global var"
Expand Down

0 comments on commit a51eb67

Please sign in to comment.