# Found some weird behavior. Thought I would ask here

**URL:** <https://in-thread.sonic-pi.net/t/found-some-weird-behavior-thought-i-would-ask-here/2145>\
**Category:** Support, Help & Resources\
**Created:** [March 21, 2019, 2:22am UTC](https://in-thread.sonic-pi.net/t/found-some-weird-behavior-thought-i-would-ask-here/2145 "2019-03-21T02:22:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrSkeletal](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/mrskeletal/32/890_2.png) [@MrSkeletal](https://in-thread.sonic-pi.net/u/MrSkeletal)\
**Post date:** [March 21, 2019, 2:22am UTC](https://in-thread.sonic-pi.net/t/found-some-weird-behavior-thought-i-would-ask-here/2145/1 "2019-03-21T02:22:58Z")

</div>

I was starting with a base from another song, so I dropped the code in, and made some slight changes. However, instead of giving me any errors. I get some weird behavior.

This is the code  
[https://pastebin.com/3hd0aTb0](https://pastebin.com/3hd0aTb0)

For some reason, when I run it, nothing happens, and then, my enter key will not work in Sonic Pi at all. I can back space, I can type, but I can’t hit enter and go to the next line for the life of me.

When I use it outside of Sonic Pi, it is fine, and when I restart it.

Does anyone here seen something like this? It seems like an extremely weird error.

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [March 21, 2019, 12:41pm UTC](https://in-thread.sonic-pi.net/t/found-some-weird-behavior-thought-i-would-ask-here/2145/2 "2019-03-21T12:41:13Z")

</div>

Just for the record, in case the pastebin link disappears here’s the code that was pasted:

```ruby
use_bpm 132

#Arpeggios and Note Methods
define :intro do
  introNotes = [:cs4,:fs3,:fs4,:cs3,:fs4,:fs2,:cs3,:es3, :d3, :bs4].choose
  puts intro
  x = 0
  #Sleep 5 total
  10.times do
    play introNotes, release: 4, sustain: 4
    x = x + 1
    sleep 8
  end
end

with_synth :blade do
  intro
end

```

The issue here is in the following line defined in the function `:intro`:

```ruby
 puts intro

```

This is an example of infinite recursion.

In order to print the value of `intro` the function `intro` must be called. Of course, the definition of `intro` includes this line, so it calls itself again again until the computer can’t keep up.

Remove this line, or if you just want to log that the `intro` function was called, simply convert it to a string:

```ruby
puts "intro"

```

I hope that this helps 🙂

---

<div class="post-metadata">

**Author:** ![MrSkeletal](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/mrskeletal/32/890_2.png) [@MrSkeletal](https://in-thread.sonic-pi.net/u/MrSkeletal)\
**Post date:** [March 21, 2019, 2:52pm UTC](https://in-thread.sonic-pi.net/t/found-some-weird-behavior-thought-i-would-ask-here/2145/3 "2019-03-21T14:52:44Z")

</div>

ohhhhhh. I gotcha. I was trying to debug something and thought I was putting out the note. Thank for that catch.

So, if i see this behavior, it’s because I got a infinite loop. I gotcha.

Thanks for the help. I couldn’t figure what in the code could cause my keyboard to stop working. haha
