---
title: "Ruby 2.6 adds support for non-ASCII capital letter"
description:
  "Ruby 2.6 adds support for non-ASCII capital letter as a first character in
  constant name"
canonical_url: "https://www.bigbinary.com/blog/ruby-2.6-adds-support-for-non-ascii-capital-case-constant"
markdown_url: "https://www.bigbinary.com/blog/ruby-2.6-adds-support-for-non-ascii-capital-case-constant.md"
---

# Ruby 2.6 adds support for non-ASCII capital letter

Ruby 2.6 adds support for non-ASCII capital letter as a first character in
constant name

- Author: Rohan Pujari
- Published: August 22, 2018
- Categories: Ruby 2.6, Ruby

Before Ruby 2.6, constant must have a capital ASCII letter as the first
character. It means class and module name cannot start with non-ASCII capital
character.

Below code will raise `class/module name must be CONSTANT` exception.

```ruby
  class Большойдвоичный
  end
```

We can use above non-ASCII character as a method name or variable name though.

Below code will run without any exception

```ruby
  class NonAsciiMethodAndVariable
    def Большойдвоичный
      Имя = "BigBinary"
    end
  end
```

"Имя" is treated as a variable name in above example, even though first
letter(И) is a capital non-ASCII character.

#### Ruby 2.6

Ruby 2.6 relaxes above mentioned limitation. We can now define constants in
languages other than English. Languages having capital letters like Russian and
Greek can be used to define constant name.

Below code will run without exception in any Ruby 2.6.

```ruby
  class Большойдвоичный
  end
```

As capital non-Ascii characters are now treated as constant, below code will
raise a warning in Ruby 2.6.

```ruby
  irb(main):001:0> Имя = "BigBinary"
  => "BigBinary"
  irb(main):002:0> Имя = "BigBinary"
  (irb):2: warning: already initialized constant Имя
  (irb):1: warning: previous definition of Имя was here
```

Above code will run without any warnings on Ruby versions prior to 2.6

Here is relevant [commit](https://github.com/ruby/ruby/commit/f852af) and
[discussion](https://bugs.ruby-lang.org/issues/13770) for this change.

## Links

- [Human page](https://www.bigbinary.com/blog/ruby-2.6-adds-support-for-non-ascii-capital-case-constant)
