← All snippets

Pizza order

Shared 28 October 2026. Link: /share/2

The code
set toppings to "cheese", "mushroom", "olive"
set price to 8 + count of toppings * 1.5
show "<p>A pizza with [toppings] costs $[price].</p>"
show "<ul>"
for each topping in toppings
  show "<li>[uppercase of topping]</li>"
end
show "</ul>"
What it shows
Save, then link to the new row
set added to ask database "insert into snippets (title, code, shared) values (?, ?, ?) returning id" with snippet_title, snippet_code, now
go to "/share/[id of first of added]"

set slug to last of split path by "/"
set snippet to ask database "select title, code from snippets where cast(id as text) = ?" with slug
show code code of first of snippet
set result to try code of first of snippet

Shared code runs inside try: no files, no database, no cookies, no email, and loops stop after 20,000 steps. Its output is shown in a sandboxed frame, so even HTML it makes stays inside.