DAY #62

You can use “#” to escape/pad strings in swift.

1
2
3
4
5
6
let name = "Nathan"
print(#"Hello \#(name)"#)
// prints: Hello Nathan

print(#"Insert "Some Stuff" here"#)
// prints: Insert "Some Stuff" here

It can be helpful for writing more readable code, since using “" to escape can be tedious.

Fun fact: This feature was developed by a student at Georgia Tech!

Originally published 10/19/2021 @ https://pittcsc.org/ Discord

Published here on 09/20/2022. Blog published date reflects the original date of publication.