# How to create an unevaluated block for scratch expressions?

**URL:** https://discourse.julialang.org/t/how-to-create-an-unevaluated-block-for-scratch-expressions/40550
**Category:** New to Julia
**Created:** [June 1, 2020, 9:45am UTC](https://discourse.julialang.org/t/how-to-create-an-unevaluated-block-for-scratch-expressions/40550 "2020-06-01T09:45:36Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mwgkgk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mwgkgk/32/15340_2.png) [@mwgkgk](https://discourse.julialang.org/u/mwgkgk)
#### Post date: [June 1, 2020, 9:45am UTC](https://discourse.julialang.org/t/how-to-create-an-unevaluated-block-for-scratch-expressions/40550/1 "2020-06-01T09:45:37Z")

</div>

Hey guys!

I’m used to littering the code with copious amounts of top-level blocks, serving as evaluation history, like here:

Clojure:

```nohighlight
#_
(do
    (stuff-and-things)
    (more-stuff-and-more-things))

```

Common Lisp:

```nohighlight
#+nil
(progn
    nil)

```

I leave these behind most functions in my private projects as a permanent scratchpad, composing parts of the function, trying it out with different arguments, etc. I realize that this may not be the best practice for open projects, it’s just something I do for myself to iterate faster.

These blocks are ignored by the reader in both cases, and don’t impact the end product.

```julia
if false
    println("hi")
endif

```

This surprisingly only works if it’s the only such top-level block in the file. On the second one, it breaks with `LoadError: syntax: incomplete: premature end of input`, pointing to the `if false` line.

I’m looking for advice both for how to idiomatically approach something like this, and perhaps for creative workarounds! Thank you.

---

<div class="post-metadata">

### Author: ![mwgkgk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mwgkgk/32/15340_2.png) [@mwgkgk](https://discourse.julialang.org/u/mwgkgk)
#### Post date: [June 1, 2020, 9:51am UTC](https://discourse.julialang.org/t/how-to-create-an-unevaluated-block-for-scratch-expressions/40550/2 "2020-06-01T09:51:14Z")

</div>

The blocks are just containers for the expressions within, I mostly send the expressions to repl one by one.

---

<div class="post-metadata">

### Author: ![rfourquet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rfourquet/32/3610_2.png) [@rfourquet](https://discourse.julialang.org/u/rfourquet)
#### Post date: [June 1, 2020, 10:30am UTC](https://discourse.julialang.org/t/how-to-create-an-unevaluated-block-for-scratch-expressions/40550/3 "2020-06-01T10:30:58Z")

</div>

> [@mwgkgk](#):
>
> ```julia
> if false
> println("hi")
> endif
> 
> ```

Might be because an `if` block requires to be closed with `end` (not `endif`)

---

<div class="post-metadata">

### Author: ![mwgkgk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mwgkgk/32/15340_2.png) [@mwgkgk](https://discourse.julialang.org/u/mwgkgk)
#### Post date: [June 1, 2020, 11:17am UTC](https://discourse.julialang.org/t/how-to-create-an-unevaluated-block-for-scratch-expressions/40550/4 "2020-06-01T11:17:57Z")

</div>

Oh wow!

Well that was a mess. Thank you!
