To be able to edit code and run cells, you need to run the notebook yourself. Where would you like to run the notebook?

This notebook takes about 20 seconds to run.

In the cloud (experimental)

Binder is a free, open source service that runs scientific notebooks in the cloud! It will take a while, usually 2-7 minutes to get a session.

On your computer

(Recommended if you want to store your changes.)

  1. Copy the notebook URL:
  2. Run Pluto

    (Also see: How to install Julia and Pluto)

  3. Paste URL in the Open box

Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Author 1

Hiding everything below a cell

This notebook defines a widget hide_everything_below. When shown as the output of a cell, all subsequent cells will be hidden. You can unhide those cells by removing the widget.

👀 Reading hidden code
300 μs

Example

Reveal the rest of this notebook:

👀 Reading hidden code
begin
b = @bind reveal html"<input type=checkbox>"
md"""
## Example
Reveal the rest of this notebook: $(b)
"""
end
245 ms
👀 Reading hidden code
if reveal === true
md"Here we go!"
else
end
29.1 ms

A Pluto notebook is made up of small blocks of Julia code (cells) and together they form a reactive notebook. When you change a variable, Pluto automatically re-runs the cells that refer to it. Cells can even be placed in arbitrary order - intelligent syntax analysis figures out the dependencies between them and takes care of execution.

Cells can contain arbitrary Julia code, and you can use external libraries. There are no code rewrites or wrappers, Pluto just looks at your code once before evaluation.

👀 Reading hidden code
279 μs
1
x = 1
👀 Reading hidden code
10.5 μs
123
123
👀 Reading hidden code
15.1 μs
3
x + 2
👀 Reading hidden code
10.9 μs
hide_everything_below =
html"""
<style>
pluto-cell.hide_everything_below ~ pluto-cell {
display: none;
}
</style>
<script>
const cell = currentScript.closest("pluto-cell")
const setclass = () => {
console.log("change!")
cell.classList.toggle("hide_everything_below", true)
}
setclass()
const observer = new MutationObserver(setclass)
observer.observe(cell, {
subtree: false,
attributeFilter: ["class"],
})
invalidation.then(() => {
observer.disconnect()
cell.classList.toggle("hide_everything_below", false)
})
</script>
""";
👀 Reading hidden code
49.7 μs
hide_everything_below
👀 Reading hidden code
11.9 μs

I am hidden!

👀 Reading hidden code
202 μs