Documentation

PT210 (specialty test)

Back to documentation index
{
  "@context": "https://nxdlang.org/schema",
  "doc_id": "PT210",
  "title": "PT210",
  "description": "Specialty Nim Tests",
  "layer": "Passed Tests",
  "category": "Passed Specialty Test",
  "keywords": [],
  "doc_version": "1.0",
  "status": "active"
}

# PT210 (specialty test)

### NXD Sample:

```nxd
MODULE NIM_COMPTIME_CONSTANT

FUNC MAIN()
    CONST RESULT SET 40 ADD 2
    PRINTLN(RESULT)


```

### Result:

COMPILER: PASS
SEMANTICS: PASS

### Expected Output:



### Actual Output:

```json
{
  "module": {
    "name": "NIM_COMPTIME_CONSTANT",
    "imports": []
  },
  "types": [],
  "traits": [],
  "impls": [],
  "functions": [
    {
      "name": "MAIN",
      "params": [],
      "return_type": null,
      "body": [
        {
          "Const": {
            "name": "RESULT",
            "value": {
              "Binary": {
                "kind": "ADD",
                "left": {
                  "Literal": {
                    "Int": 40
                  }
                },
                "right": {
                  "Literal": {
                    "Int": 2
                  }
                }
              }
            }
          }
        },
        {
          "Expr": {
            "Call": {
              "func": "PRINTLN",
              "args": [
                {
                  "Var": "RESULT"
                }
              ]
            }
          }
        }
      ]
    }
  ],
  "statements": []
}
```

```nim
# nim_comptime_constant


proc main() =
  let result = 40 + 2
  println(result)

```

### Notes: