# Nim [![Build Status][badge-nim-travisci]][nim-travisci] This repository contains the Nim compiler, Nim's stdlib, tools and documentation. For more information about Nim, including downloads and documentation for the latest release, check out [Nim's website][nim-site]. ## Community [![Join the IRC chat][badge-nim-irc]][nim-irc] [![Join the Gitter chat][badge-nim-gitter]][nim-gitter] [![Get help][badge-nim-forum-gethelp]][nim-forum] [![View Nim posts on Stack Overflow][badge-nim-stackoverflow]][nim-stackoverflow-newest] [![Follow @nim_lang on Twitter][badge-nim-twitter]][nim-twitter] * The [forum][nim-forum] - the best place to ask questions and to discuss Nim. * [#nim IRC Channel (Freenode)][nim-irc] - a place to discuss Nim in real-time. Also where most development decisions get made. * [Gitter][nim-gitter] - an additional place to discuss Nim in real-time. There is a bridge between Gitter and the IRC channel. * [Stack Overflow][nim-stackoverflow] - a popular Q/A site for programming related topics that includes posts about Nim. * [Github Wiki][nim-wiki] - Misc user-contributed content. ## Compiling The compiler currently officially supports the following platform and architecture combinations: * Windows (Windows XP or greater) - x86 and x86_64 * Linux (most, if not all, distributions) - x86, x86_64, ppc64 and armv6l * Mac OS X (10.04 or greater) - x86, x86_64 and ppc64 More platforms are supported, however they are not tested regularly and they may not be as stable as the above-listed platforms. Compiling the Nim compiler is quite straightforward if you follow these steps: First, the C source of an older version of the Nim compiler is needed to bootstrap the latest version because the Nim compiler itself is written in the Nim programming language. Those C sources are available within the [``nim-lang/csources``][csources-repo] repository. Next, to build from source you will need: * A C compiler such as ``gcc`` 3.x/later or an alternative such as ``clang``, ``Visual C++`` or ``Intel C++``. It is recommended to use ``gcc`` 3.x or later. * Either ``git`` or ``wget`` to download the needed source repositories. * The ``build-essential`` package when using ``gcc`` on Ubuntu (and likely other distros as well). Then, if you are on a \*nix system or Windows, the following steps should compile Nim from source using ``gcc``, ``git`` and the ``koch`` build tool (in the place of ``sh build.sh`` you should substitute ``build.bat`` on x86 Windows or ``build64.bat`` on x86_64 Windows): **Note: The following commands are for the development version of the compiler.** For most users, installing the latest stable version is enough. Check out the installation instructions on the website to do so: https://nim-lang.org/install.html. ``` git clone https://github.com/nim-lang/Nim.git cd Nim git clone --depth 1 https://github.com/nim-lang/csources.git cd csources sh build.sh cd ../ bin/nim c koch ./koch boot -d:release ./koch tools # Compile Nimble and other tools. ``` Finally, once you have finished the build steps (on Windows, Mac or Linux) you should add the ``bin`` directory to your PATH. ## Koch ``koch`` is the build tool used to build various parts of Nim and to generate documentation and the website, among other things. The ``koch`` tool can also be used to run the Nim test suite. Assuming that you added Nim's ``bin`` directory to your PATH, you may execute the tests using ``./koch tests``. The tests take a while to run, but you can run a subset of tests by specifying a category (for example ``./koch tests cat async``). For more information on the ``koch`` build tool please see the documentation within the [doc/koch.rst](doc/koch.rst) file. ## Nimble
discard """
  file: "tenumoffset.nim"
  output: "my value A1my value Bconc2valueCabc4abc"
"""

const
  strValB = "my value B"

type
  TMyEnum = enum
    valueA = (1, "my value A"),
    valueB = strValB & "conc",
    valueC,
    valueD = (4, "abc")

proc getValue(i:int): TMyEnum = TMyEnum(i)

# trick the optimizer with a variable:
var x = getValue