Skip to content

Commit

Permalink
minor change in scoping
Browse files Browse the repository at this point in the history
  • Loading branch information
alrubio committed Sep 18, 2023
1 parent 6ef04e7 commit 6cf82a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mkdocs/docs/circom-language/scoping.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ component main = A(5);

since the condition `i < n` is known at compilation time, and then the declaration of signal `out` is allowed. However, if the condition was `in < n`, since it is not known at compilation time, it would output an error message because the declaration in that case is not allowed.

In any case, we apply a static scoping like in C++ or Rust, and a signal declared inside an if block is only visible inside the block it is declared.
In any case, we apply a static scoping like in C++ or Rust, and a signal declared inside an `if` block is only visible inside the block it is declared.

Regarding visibility of signals of subcomponent, a signal `x` of component `c` is also visible in the template `t` that has declared `c`, using the notation `c.x`, if `x` is an input or and output of `c`. No access to intermediate signals of sub-components or signals of nested sub-components is allowed. For instance, if `c` is built using another component `d`, the signals of `d` cannot be accessed from `t`. This can be seen in the next code:

Expand Down

0 comments on commit 6cf82a8

Please sign in to comment.