# Unexpected infinite loop when calling a simple function

**URL:** <https://discourse.julialang.org/t/unexpected-infinite-loop-when-calling-a-simple-function/52482>\
**Category:** General Usage\
**Tags:** function\
**Created:** [December 28, 2020, 12:31am UTC](https://discourse.julialang.org/t/unexpected-infinite-loop-when-calling-a-simple-function/52482 "2020-12-28T00:31:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chen](https://avatars.discourse-cdn.com/v4/letter/c/3d9bf3/32.png) [@Chen](https://discourse.julialang.org/u/Chen)\
**Post date:** [December 28, 2020, 12:31am UTC](https://discourse.julialang.org/t/unexpected-infinite-loop-when-calling-a-simple-function/52482/1 "2020-12-28T00:31:27Z")

</div>

I’m trying to create a function that calls another function.

```julia
using Weave

function knytte( file_name, doc_type )
    weave( file_name, doctype = doc_type )
end

knytte( "test.jmd", "md2html" )

```

The content of “test.jmd” could be anything.

Somehow julia just kept executing the weave() function over and over.

Does someone have an idea how the code needs to be changed?

Thanks!

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [December 28, 2020, 5:08am UTC](https://discourse.julialang.org/t/unexpected-infinite-loop-when-calling-a-simple-function/52482/2 "2020-12-28T05:08:51Z")

</div>

I just tried running exactly your code with `test.jmd` containing just:

```nohighlight
#hello world

```

and it ran correctly. I also don’t see anything obviously wrong with the code you’ve written.

Can you post the simplest possible `test.jmd` that reproduces the issue for you?

---

<div class="post-metadata">

**Author:** ![Chen](https://avatars.discourse-cdn.com/v4/letter/c/3d9bf3/32.png) [@Chen](https://discourse.julialang.org/u/Chen)\
**Post date:** [December 28, 2020, 9:37am UTC](https://discourse.julialang.org/t/unexpected-infinite-loop-when-calling-a-simple-function/52482/3 "2020-12-28T09:37:27Z")

</div>

Thank you!

I made a mistake in the julia markdown file. I was calling the knytte() function to the julia markdown file, in the julia markdown file. This created the infinite loop!
