Skip to content

Commit e8bf9bc

Browse files
authored
Add more @showarg examples (#52410)
Adds a few more examples to show how `@showarg` works with literals and interpolated string expressions.
1 parent dba215f commit e8bf9bc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

doc/src/manual/metaprogramming.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,15 @@ julia> @showarg(1+1)
629629
630630
julia> @showarg(println("Yo!"))
631631
:(println("Yo!"))
632+
633+
julia> @showarg(1) # Numeric literal
634+
1
635+
636+
julia> @showarg("Yo!") # String literal
637+
"Yo!"
638+
639+
julia> @showarg("Yo! $("hello")") # String with interpolation is an Expr rather than a String
640+
:("Yo! $("hello")")
632641
```
633642

634643
In addition to the given argument list, every macro is passed extra arguments named `__source__` and `__module__`.

0 commit comments

Comments
 (0)