1

For me, English is too big a mountain. So whenever I use tools like Visual Studio 2017 (C ++), Unity 3D(C#), Visual Studio Code (html), Eclipse (java), and Android Studio, I've always assigned variables in my native language.

ex)

    int get넓이(int 가로, int 세로)
    {
        int square = 가로 * 세로;
        return square;
    }

However, many people advised not to use non-English variable names because they can 'cause errors'. But I have not experienced any errors yet.

I also contacted the Unity Game Engine customer center on this issue. And they answered me like this. "You can do this by going to [Visual Studio → File → Advanced Save Options], and then specify" Save as default encoding option "to UTF-8."

So, I wonder if there is an error when programming in a language other than English. because I have not experienced errors using non-English variable names. I have also contacted other community sites on this issue, but I have not seen anyone who experienced the issue.

HellJosun
  • 129
  • 1
  • 10
  • 1
    [Should I avoid using unicode characters in variable names?](https://stackoverflow.com/q/24458953/995714), [Is it a good idea to use unicode symbols as Java identifiers?](https://stackoverflow.com/q/2793792/995714) – phuclv Nov 09 '17 at 11:21
  • There are many considerations: 1. Does the language support it? 2. Do your teammates support it? 3. Will this cause any issues in the future with new "foreign language" developers? – deceze Nov 09 '17 at 11:21
  • 2
    I'd say don't do it (I had it as requirement once, it wasn't a good idea). Apart from what @deceze said, note that you will start mixing languages wich will be worse than having any 1 language. Just take a look at `get넓이`. And with more delevopers, you will stat to name the same term in difference languages. – Daniel Nov 09 '17 at 11:26
  • Personally the only time I'd accept non-English terminology is if it's code related to culture-specific things; e.g. code that processes Japanese will probably use a variable named `kanji` somewhere, and code having to do with the German tax system might use `vermögenssteuer` somewhere since it would be somewhere between confusing and impossible to find an English language equivalent. At virtually no point would I endorse a writing system illegible to the majority of developers, since that really limits your future choice of employees. – deceze Nov 09 '17 at 11:31
  • Thank you for your detailed answer. I will also assign the variable name in English if I collaborate with someone else. – HellJosun Nov 09 '17 at 11:31

2 Answers2

2

It completely depends on what language you are programming in. For example, Python3 will support it (mostly, as long as it's Unicode), however, Python2 will not like it at all as it only supports ASCII.

As with any code, if it makes it easier for you then do it. Just try your best to make it readable to others if it is going to be deployed to others. Just make sure your language fully supports Unicode.

Polymer
  • 1,108
  • 1
  • 9
  • 17
1

C++ has supported Unicode identifiers for a long time with some compiler caveats. So do Java and C#. So there should be no problem compiling it unless you use an old compiler or and old C or C++ standard

However code is for others to read later. Unless you don't want anybody to maintain your code you can use variables in another language.

phuclv
  • 37,963
  • 15
  • 156
  • 475