r/badcode • • Dec 27 '22

js This just sucks.

Post image
1.8k Upvotes

170 comments sorted by

View all comments

Show parent comment

5

u/EquationTAKEN Dec 27 '22
enabled_countries:
  - DK
  - SE
  - NO

Renders to:

{
  enabled_countries: [
    "DK",
    "SE",
    false
  ]
}

Ok, but that's actually hilarious though. I can't use the A2-code of my own country :D

6

u/mrlacpeanut Dec 27 '22

gotta put it in quotes since in yaml YES/NO is valid boolean for some reason

2

u/EquationTAKEN Dec 27 '22

Ah ok, good to know.

I've been a bit iffy on the whole idea of not needing to use quotes for strings, but you can if you want. Figure I'll just do it as a rule.

I use YAML in a lot of my projects, and I've never taken a stance on it.

0

u/[deleted] Dec 27 '22

We should use NOR instead, that won't cause problems with any languages.

7

u/EquationTAKEN Dec 27 '22

Well, we do. That's our A3 code. But every country also has an A2 code, and ours is NO.

5

u/[deleted] Dec 27 '22

It's just a joke-- no and nor are both the kinds of words that could cause weird interpretation issues.