Documentation

nim_scope_lifetime

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

### PT209 (specialty test)

NXD Sample:

```nxd
MODULE NIM_SCOPE_LIFETIME

FUNC CREATE_VALUE()
    LET VALUE SET "temporary"
    PRINTLN(VALUE)

FUNC MAIN()
    CREATE_VALUE()
    PRINTLN("complete")
```

Result:

COMPILER:
SEMANTICS:

Expected Output:

Actual Output:

```json
{
  "module": {
    "name": "NIM_SCOPE_LIFETIME",
    "imports": []
  },
  "types": [],
  "traits": [],
  "impls": [],
  "functions": [
    {
      "name": "CREATE_VALUE",
      "params": [],
      "return_type": null,
      "body": [
        {
          "Let": {
            "name": "VALUE",
            "value": {
              "Literal": {
                "String": "temporary"
              }
            }
          }
        }
      ]
    },
    {
      "name": "MAIN",
      "params": [],
      "return_type": null,
      "body": [
        {
          "Expr": {
            "Call": {
              "func": "CREATE_VALUE",
              "args": []
            }
          }
        }
      ]
    }
  ],
  "statements": []
}
```

```nim
# nim_scope_lifetime


proc create_value() =
  var value = "temporary"

proc main() =
  create_value()


```

Notes: