# Are sanity checks allowed?

There are times when I have written code that looks insane when I step back from it. It is during those times where I might need a sanity check. So, is asking for a sanity check allowed?

For example, I have two for loops iterating over the same list to create two arrays. Is it sane to keep the loops separate, or should I merge them into one loop?

Sanity checks are for code that works but may look weird or strange to the author. Sometimes an author may just need a virtual hug.

• Can you define what a sanity check is? – Peilonrayz Jul 12 at 13:46
• Should I put the example in the post? – Lady Aleena Jul 12 at 13:48
• Yes. An example and an explanation of what a sanity check is would probably help. – Peilonrayz Jul 12 at 13:49
• An example and explanation are added. – Lady Aleena Jul 12 at 14:01
• From what I can tell in itself a sanity check would be on-topic, but it's much more likely that you get more than you bargained for around here. It's also likely that posting here requires a comparatively high effort for just a quick sanity check. It's probably much more helpful to find a coworker or friend to have a quick look if all you want is a sanity check... – Vogel612 Jul 12 at 14:26
• My friends don't know perl, and I don't have a job. I am used to waiting for sanity checks. – Lady Aleena Jul 12 at 22:32

# On-topic

1. The code works the way that you want it to.
2. Have the relevant code in the question.
3. Have provided enough code that we can actually give genuine feedback.
4. Explained the code in the body of the question.
5. Have a title that is a short summary of the code.

For example, I have two for loops iterating over the same list to create two arrays. Is it sane to keep the loops separate, or should I merge them into one loop?

If this is the example question then:

1. ✔️
2. ❌ We have not got the code.
3. ✔️/❌ Depending on the code, make sure you provide the code as is.
4. ❌ You have not explained what the code is creating or why the code is creating it.
• If I were to post a sanity check, the working code will be included. The "example" would be a question relevant to the included working code. The code would be explained in as much detail as possible. Code wasn't included in my question here since I didn't want THIS question to turn into help with the code. Code will be included in my posts in Main Code Review. – Lady Aleena Jul 25 at 17:14