Skip to content

Commit

Permalink
Converted interpolation example code chunk to markdown to prevent it …
Browse files Browse the repository at this point in the history
…from running.
  • Loading branch information
Karandeep Singh committed Jul 15, 2023
1 parent ca8c156 commit b0dc05c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions docs/examples/UserGuide/interpolation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ end

# We first need to initialize the global variable using `global_col = Symbol()`.

```julia
global_col = Symbol()
for col in [:a, :b, :c]
global global_col = col
@chain df begin
@select(@eval(Main, global_col))
println
end
end
```
# ```julia
# global_col = Symbol()
# for col in [:a, :b, :c]
# global global_col = col
# @chain df begin
# @select(@eval(Main, global_col))
# println
# end
# end
# ```

# The reason this works is because the `@eval()` macro inside `@select()` is not evaluated right away (unlike `!!`) but rather is evaluated at a later stage and thus is updated with each iteration. Instead of using the `@eval()` macro, we could instead have instead written `Main.eval(:global_col)`, which is functionally the same.

0 comments on commit b0dc05c

Please sign in to comment.