File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -3901,13 +3901,19 @@ defmodule Kernel do
39013901 iex> if 7 > 5, do: "yes"
39023902 "yes"
39033903
3904- In the example above, `bar` will be returned if `foo` evaluates to
3905- a truthy value (neither `false` nor `nil`). Otherwise, `nil` will be
3906- returned.
3904+ iex> if "truthy value", do: "yes"
3905+ "yes"
3906+
3907+ In the examples above, `"yes"` will be returned because the condition
3908+ evaluates to a truthy value (neither `false` nor `nil`). Otherwise, `nil`
3909+ will be returned:
39073910
39083911 iex> if 3 > 5, do: "yes"
39093912 nil
39103913
3914+ iex> if nil, do: "yes"
3915+ nil
3916+
39113917 An `else` option can be given to specify the opposite:
39123918
39133919 iex> if 3 > 5, do: "yes", else: "no"
You can’t perform that action at this time.
0 commit comments