Skip to content

Commit

Permalink
Update argumenterror.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dcrawl authored Oct 25, 2023
1 parent 4bfb599 commit c59848c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions docs/API/ruby/argumenterror.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,26 @@ Raised when the arguments are wrong and there isn’t a more specific [Exception

The following code:

> `[1, 2, 3].first(4, 5)`
```ruby
[1, 2, 3].first(4, 5)
```

will trigger this exception:

> `ArgumentError: wrong number of arguments (given 2, expected 1)`
```
ArgumentError: wrong number of arguments (given 2, expected 1)
```


## Example 2: Passing an argument that is not acceptable

> `[1, 2, 3].first(-4)`
```ruby
[1, 2, 3].first(-4)
```

the negative number being an invalid argument will trigger this response:

> `ArgumentError: negative array size`
```
ArgumentError: negative array size
```

0 comments on commit c59848c

Please sign in to comment.