# Indentation in the Sonic Pi Editor

**URL:** <https://in-thread.sonic-pi.net/t/indentation-in-the-sonic-pi-editor/6753>\
**Category:** Support, Help & Resources\
**Created:** [May 7, 2022, 7:37pm UTC](https://in-thread.sonic-pi.net/t/indentation-in-the-sonic-pi-editor/6753 "2022-05-07T19:37:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![klynn47](https://avatars.discourse-cdn.com/v4/letter/k/5fc32e/32.png) [@klynn47](https://in-thread.sonic-pi.net/u/klynn47)\
**Post date:** [May 7, 2022, 7:37pm UTC](https://in-thread.sonic-pi.net/t/indentation-in-the-sonic-pi-editor/6753/1 "2022-05-07T19:37:56Z")

</div>

I’m having issues with indentation in the Sonic Pi editor. For some reason, after I complete the end on a function definition, the next function definition is indented instead of being at the same level as the previous define. Is there a way to turn this off in the editor? Thanks for your help.

define :ca do |\*args|  
output = Array.new(args.length())

```
for x in 0..args.length()-1 do
    output[x] = args[x]
  end
  
  return(output)

```

end

define :pm do |\*args|  
notes = args[0]

```
    for x in 0..(notes.length()-1)/2 do
        if (notes[2*x] != "r") then
          play notes[2*x]
        end
        
        sleep notes[2*x+1]
      end
    end
```

---

<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:** [May 7, 2022, 11:05pm UTC](https://in-thread.sonic-pi.net/t/indentation-in-the-sonic-pi-editor/6753/2 "2022-05-07T23:05:13Z")

</div>

> [@klynn47](#):
>
> define :pm do |\*args|  
> notes = args[0]
> 
> ```ruby
> for x in 0..(notes.length()-1)/2 do
> if (notes[2*x] != "r") then
> play notes[2*x]
> end
>         
> sleep notes[2*x+1]
> end
> end
> 
> ```

Hi @klynn47 - that’s weird, I’m not seeing the same behaviour on my system.

Could you possibly let us know which version of Sonic Pi you’re running and on which operating system?

---

<div class="post-metadata">

**Author:** ![klynn47](https://avatars.discourse-cdn.com/v4/letter/k/5fc32e/32.png) [@klynn47](https://in-thread.sonic-pi.net/u/klynn47)\
**Post date:** [May 7, 2022, 11:07pm UTC](https://in-thread.sonic-pi.net/t/indentation-in-the-sonic-pi-editor/6753/3 "2022-05-07T23:07:43Z")

</div>

It is version 3.3.1 on Windows 11

---

<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:** [May 7, 2022, 11:24pm UTC](https://in-thread.sonic-pi.net/t/indentation-in-the-sonic-pi-editor/6753/4 "2022-05-07T23:24:10Z")

</div>

Hi there,

yep, I can confirm that this is an issue as you mention in v3.3.1. However, in the latest v4 BETA release, the indentation is fine 🙂

So the problem should be resolved when you upgrade from v3.3.1. Apologies for the inconvenience until then.

---

<div class="post-metadata">

**Author:** ![klynn47](https://avatars.discourse-cdn.com/v4/letter/k/5fc32e/32.png) [@klynn47](https://in-thread.sonic-pi.net/u/klynn47)\
**Post date:** [May 7, 2022, 11:26pm UTC](https://in-thread.sonic-pi.net/t/indentation-in-the-sonic-pi-editor/6753/5 "2022-05-07T23:26:34Z")

</div>

Thanks for your response. I appreciate it
