Pluto allows you to disable a cell, which means that it will not get executed with reactivity. When one of the dependencies of a disabled cell changes, the disabled cell will not get executed as usual.
Disabled cells are indicated by a โgreyed-outโ appearance. Pressing the โRunโ button (Shift-Enter) will not execute the cell, but it will save any changes to the cell code.
In this video, the disabled cell no longer responds to changes in the count variable. (The same applies when count is defined in code, instead of with a slider.)
count
The cell disabling feature is reactive โย any cells that depend on a disabled cell will also be disabled. This ensures that the notebook remains consistent, and there is no code that executes with old values that no longer exist.
This is also a really powerful feature, because you can easily disable a large number of cells at once, by disabling a core cell that is used in all of them.
In this video, the last cell is disabled indirectly, because it depends on the disabled cell through the text variable.
text
Disabling a cell can also be useful for other purposes, such as:
There is also the option to disable a cell in the file. This makes no difference when running the notebook in Pluto, but the cell code will be stored as a Julia comment in the file.
This is useful when you are writing a Pluto notebook file (.jl) that is also used as a Julia script. This lets you write code that is only executed when the notebook is used in Pluto, such as additional plots, testing, or more.
.jl
Notice the gray markers to the right of the cells, marking a cell disabled in file (second cell) and a cell disabled indirectly in file (last cell).
Before the cell is disabled in file, the .jl notebook file looks like:
# โโโก d5697b7b-a916-468c-9a2a-e84a87d7320f @bind count Slider(5:20) # โโโก 6a653410-c595-45fb-8357-6ffe815e9d49 text = repeat("๐", count) # โโโก 94216444-bcfb-4925-bc16-44b698181286 sum(codeunits(text))
After disabling the second cell in file, you get:
# โโโก d5697b7b-a916-468c-9a2a-e84a87d7320f @bind count Slider(5:20) # โโโก 6a653410-c595-45fb-8357-6ffe815e9d49 # โ โโก skip_as_script = true #=โ โโก text = repeat("๐", count) โ โโก =# # โโโก 94216444-bcfb-4925-bc16-44b698181286 #=โ โโก sum(codeunits(text)) โ โโก =#
The Disable in File feature is reactive, just like the โDisableโ feature. This means that any cells that depend on a cell that is disabled in file will also be disabled in file. The reasons here are similar: it makes sense for consistency, and it makes it easy to disable a large number of cells at once.