mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-12-09 05:05:55 +08:00
Tiny improvements to explore livebooks (#1266)
* Tiny improvement in explanation of pattern matching * remove reference to `Kino.Ecto`
This commit is contained in:
parent
c6286e8630
commit
14538b7aa1
2 changed files with 2 additions and 4 deletions
|
|
@ -197,7 +197,7 @@ if the date is valid or not? We can use `case` to pattern match on
|
|||
the different tuples:
|
||||
|
||||
```elixir
|
||||
# Give a random date as input
|
||||
# Give an invalid date as input
|
||||
input = "2020-02-30"
|
||||
|
||||
# And then match on the return value
|
||||
|
|
@ -214,7 +214,7 @@ In this example, we are using `case` to pattern match on the different
|
|||
outcomes of the `Date.from_iso8601`. We say the `case` above has two
|
||||
clauses, one matching on `{:ok, date}` and another on `{:error, reason}`.
|
||||
Now try changing the `input` variable above and reevaluate the cell
|
||||
accordingly. What happens when you give it an invalid date?
|
||||
accordingly. What happens when you give it a valid date?
|
||||
|
||||
Finally, we can also pattern match on maps. This is used to extract the
|
||||
values for the given keys:
|
||||
|
|
|
|||
|
|
@ -141,8 +141,6 @@ end
|
|||
Having the rows inserted, click on the "Refetch" icon in the table output
|
||||
above to see them.
|
||||
|
||||
Similar functionality is available for database queries via [Ecto](https://github.com/elixir-ecto/ecto) and the [`Kino.Ecto`](https://hexdocs.pm/kino/Kino.Ecto.html) module.
|
||||
|
||||
<!-- livebook:{"branch_parent_index":0} -->
|
||||
|
||||
## Kino.render/1
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue