Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions concepts/basics/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ end
my_first_calc = Calculator.new
```

Classes can contain other classes (_inner classes_):

```
# Define outer class
class Calculator

class SpecialHandler
# ...
end

# ...
end
```

Units of functionality are encapsulated in methods - similar to _functions_ in other languages. A method can optionally be defined with positional arguments, and/or keyword arguments that are defined and called using the `:` syntax. Methods either implicitly return the result of the last evaluated statement, or can explicitly return an object via the `return` keyword. Methods are invoked using `.` syntax.

```ruby
Expand Down
14 changes: 14 additions & 0 deletions exercises/concept/lasagna/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ end
my_first_calc = Calculator.new
```

Classes can contain other classes (_inner classes_):

```
# Define outer class
class Calculator

class SpecialHandler
# ...
end

# ...
end
```

## Methods

Units of functionality are encapsulated in methods - similar to _functions_ in other languages.
Expand Down
Loading