Fix format of markdown query help files

This commit is contained in:
Owen Mansel-Chan
2025-06-11 16:50:06 +01:00
parent afc78ced50
commit 9521994adc
32 changed files with 85 additions and 152 deletions

View File

@@ -1,6 +1,4 @@
# Method call on `nil`
## Description
## Overview
In Ruby, it is not necessary to explicitly initialize variables.
If a local variable has not been explicitly initialized, it will have the value `nil`. If this happens unintentionally, though, the variable will not represent an object with the expected methods, and a method call on the variable will raise a `NoMethodError`.
@@ -11,7 +9,7 @@ This can be achieved by using a safe navigation or adding a check for `nil`.
Note: You do not need to explicitly initialize the variable, if you can make the program deal with the possible `nil` value. In particular, initializing the variable to `nil` will have no effect, as this is already the value of the variable. If `nil` is the only possible default value, you need to handle the `nil` value instead of initializing the variable.
## Examples
## Example
In the following code, the call to `create_file` may fail and then the call `f.close` will raise a `NoMethodError` since `f` will be `nil` at that point.
@@ -38,4 +36,3 @@ end
- https://www.rubyguides.com/: [Nil](https://www.rubyguides.com/2018/01/ruby-nil/)
- https://ruby-doc.org/: [NoMethodError](https://ruby-doc.org/core-2.6.5/NoMethodError.html)