# Interpolated string got memoized?

**URL:** <https://discourse.julialang.org/t/interpolated-string-got-memoized/16217>\
**Category:** General Usage\
**Created:** [October 12, 2018, 7:17am UTC](https://discourse.julialang.org/t/interpolated-string-got-memoized/16217 "2018-10-12T07:17:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tk3369](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tk3369/32/2824_2.png) [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Post date:** [October 12, 2018, 7:17am UTC](https://discourse.julialang.org/t/interpolated-string-got-memoized/16217/1 "2018-10-12T07:17:11Z")

</div>

Is it a bug or am I doing something wrong?

```julia
julia> function testme2(note)
           for i ∈ 65:68
               c = Char(i)
               print("c=$c ")
               note = replace(note, "_" => "$c")
               println("testing: $note")
           end
       end
testme2 (generic function with 1 method)

julia> testme2("hello world _")
c=A testing: hello world A
c=B testing: hello world A
c=C testing: hello world A
c=D testing: hello world A

julia> function testme3(note)
           for i ∈ 65:68
               c = Char(i)
               print("c=$c ")
               note2 = replace(note, "_" => "$c")
               println("testing: $note2")
           end
       end
testme3 (generic function with 1 method)

julia> testme3("hello world _")
c=A testing: hello world A
c=B testing: hello world B
c=C testing: hello world C
c=D testing: hello world D

```

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [October 12, 2018, 7:19am UTC](https://discourse.julialang.org/t/interpolated-string-got-memoized/16217/2 "2018-10-12T07:19:35Z")

</div>

Since you replaced `_` in the first loop iteration, there is nothing to replace in subsequent iterations. Don’t overwrite variable `note`.

---

<div class="post-metadata">

**Author:** ![tk3369](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tk3369/32/2824_2.png) [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Post date:** [October 12, 2018, 7:21am UTC](https://discourse.julialang.org/t/interpolated-string-got-memoized/16217/3 "2018-10-12T07:21:26Z")

</div>

haha… my stupid mistake. Thanks!
