# I think that my logic is correct but I am getting initial value as print, why?

**URL:** <https://discourse.julialang.org/t/i-think-that-my-logic-is-correct-but-i-am-getting-initial-value-as-print-why/106120>\
**Category:** New to Julia\
**Created:** [November 12, 2023, 5:05pm UTC](https://discourse.julialang.org/t/i-think-that-my-logic-is-correct-but-i-am-getting-initial-value-as-print-why/106120 "2023-11-12T17:05:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohit](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Mohit](https://discourse.julialang.org/u/Mohit)\
**Post date:** [November 12, 2023, 5:05pm UTC](https://discourse.julialang.org/t/i-think-that-my-logic-is-correct-but-i-am-getting-initial-value-as-print-why/106120/1 "2023-11-12T17:05:59Z")

</div>

# What is the reverse complement of GCTAGCT?

function pattern\_RC(dna)  
R\_dna = “”  
ln = length(dna)  
for i in ln:-1:1  
if dna[i] == “A”  
R\_dna = R\_dna \* “T”  
elseif dna[i]== “T”  
R\_dna = R\_dna \* “A”  
elseif dna[i]== “G”  
R\_dna = R\_dna \* “C”  
elseif dna[i]== “C”  
R\_dna = R\_dna \* “G”  
else  
#println(“Error in the code”)  
end  
end  
return R\_dna  
end  
dna= “GCTAGCT”  
R\_dna = pattern\_RC(dna)  
println("Reverse Complement of DNA strand is : ", R\_dna)

I am sorry for simple stupid question. But I am trying to learn Julia by doing.

---

<div class="post-metadata">

**Author:** ![Mohit](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Mohit](https://discourse.julialang.org/u/Mohit)\
**Post date:** [November 12, 2023, 5:14pm UTC](https://discourse.julialang.org/t/i-think-that-my-logic-is-correct-but-i-am-getting-initial-value-as-print-why/106120/2 "2023-11-12T17:14:20Z")

</div>

I tried to run it with println statments to check, it seems to me that I have error in if… elseif conditions.  
Please help me.

---

<div class="post-metadata">

**Author:** ![JM\_Beckers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jm_beckers/32/22482_2.png) [@JM\_Beckers](https://discourse.julialang.org/u/JM_Beckers)\
**Post date:** [November 12, 2023, 5:15pm UTC](https://discourse.julialang.org/t/i-think-that-my-logic-is-correct-but-i-am-getting-initial-value-as-print-why/106120/3 "2023-11-12T17:15:55Z")

</div>

In Julia “A” is not ‘A’

```julia
'A'=="A"

```

yields `false`. So simply replace all " " with ’ ’ and is should work.

---

<div class="post-metadata">

**Author:** ![Mohit](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Mohit](https://discourse.julialang.org/u/Mohit)\
**Post date:** [November 12, 2023, 5:17pm UTC](https://discourse.julialang.org/t/i-think-that-my-logic-is-correct-but-i-am-getting-initial-value-as-print-why/106120/4 "2023-11-12T17:17:52Z")

</div>

wow, thanks for quick answer.  
Its always great help for newbie.  
🙏
