# Creating functions- white space?

**URL:** <https://in-thread.sonic-pi.net/t/creating-functions-white-space/7122>\
**Category:** Support, Help & Resources\
**Created:** [September 22, 2022, 5:51pm UTC](https://in-thread.sonic-pi.net/t/creating-functions-white-space/7122 "2022-09-22T17:51:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![wfrj57](https://avatars.discourse-cdn.com/v4/letter/w/df788c/32.png) [@wfrj57](https://in-thread.sonic-pi.net/u/wfrj57)\
**Post date:** [September 22, 2022, 5:51pm UTC](https://in-thread.sonic-pi.net/t/creating-functions-white-space/7122/1 "2022-09-22T17:51:41Z")

</div>

Hello! I’m having trouble creating white space for a function. When I go to define the function, if I add white space, when I go to add the next line of the function, it automatically puts my line of code back to the start of the line and deletes my white space. I’m unsure how to fix this?

---

<div class="post-metadata">

**Author:** ![emlyn](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/emlyn/32/1460_2.png) [@emlyn](https://in-thread.sonic-pi.net/u/emlyn)\
**Post date:** [September 23, 2022, 9:41am UTC](https://in-thread.sonic-pi.net/t/creating-functions-white-space/7122/2 "2022-09-23T09:41:19Z")

</div>

In the Editor tab in the Preferences, there is an option for Auto-align that is enabled by default. I thought that disabling it would prevent this behaviour, but I just tried it and it didn’t make any difference for me (on version 4.2). I’m not sure if that’s because I’ve misunderstood what it does, or if it’s broken.

As a workaround, you could put a semicolon (`;`) at the start of the line, with spaces after it, like this:

```ruby
define :myfunction do
  ; play 60
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:** [September 26, 2022, 10:28am UTC](https://in-thread.sonic-pi.net/t/creating-functions-white-space/7122/3 "2022-09-26T10:28:36Z")

</div>

> [@emlyn](#):
>
> I’m not sure if that’s because I’ve misunderstood what it does, or if it’s broken.

It was unfortunately broken, but now fixed on GitHub, so will be in the next release. Thanks for spotting this!

@wfrj57 - one thing to note is that unlike Python, Sonic Pi does not require tabs/whitespace to structure code. In other words, you can have messy code and Sonic Pi won’t mind one bit. It also means you get to choose how to indent your own code, and in the next version, you’ll be able to disable the auto indentation system and do just that 🙂

---

<div class="post-metadata">

**Author:** ![wfrj57](https://avatars.discourse-cdn.com/v4/letter/w/df788c/32.png) [@wfrj57](https://in-thread.sonic-pi.net/u/wfrj57)\
**Post date:** [September 26, 2022, 7:41pm UTC](https://in-thread.sonic-pi.net/t/creating-functions-white-space/7122/4 "2022-09-26T19:41:50Z")

</div>

Got it!! Makes sense. Thank you @emlyn and @samaaron !!

---

<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:** [September 30, 2022, 11:03am UTC](https://in-thread.sonic-pi.net/t/creating-functions-white-space/7122/5 "2022-09-30T11:03:15Z")

</div>

Hi there, just a quick message to say that v4.3 is now released which fixes the auto-indentation preference.

Have fun!

---

<div class="post-metadata">

**Author:** ![wfrj57](https://avatars.discourse-cdn.com/v4/letter/w/df788c/32.png) [@wfrj57](https://in-thread.sonic-pi.net/u/wfrj57)\
**Post date:** [September 30, 2022, 1:28pm UTC](https://in-thread.sonic-pi.net/t/creating-functions-white-space/7122/6 "2022-09-30T13:28:43Z")

</div>

Thanks so much for remembering I asked about this and letting me know about the update. Very awesome of you! Have a great day!
