I can interpolate a variable into a string to print the value with other text like this:
a = "sheriff";
println("Howdy, I'm the $a.")
Howdy, I'm the sheriff.
I need the syntax for interpolating an array element, I'm currently getting this:
A = ["carb", "sheriff", "mumchance"]
println("Howdy, I'm the $A[2].")
Howdy, I'm the String["carb", "sheriff", "mumchance"][2].
I'm posting this Q/A because I spent too much time looking for this.
println("Howdy, I'm the $(A[2]).")
String interpolation in Julia is similar to unix shells. You can interpolate expressions by wrapping them in parentheses.
Julia Documentation: Strings/Interpolation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With