Complete the code to create a new string variable.
var greeting = "Hello" var newGreeting = [1]
Strings in Swift are value types, so assigning greeting to newGreeting copies the value.
Complete the code to change the copy without affecting the original string.
var original = "Swift" var copy = original copy[1]"SwiftLang"
Assigning a new value to copy changes only the copy because strings are value types.
Fix the error in the code to correctly copy and modify the string.
var text1 = "Hello" var text2 = text1 text2.append([1])
The append method requires a string argument, so use a string literal with double quotes.
Fill both blanks to create a copy and check if original and copy are equal.
var first = "Apple" var second = [1] let areEqual = first [2] second
Assign first to second to copy the string, then use == to check equality.
Fill all three blanks to copy a string, modify the copy, and print both strings.
var original = "Cat" var copy = [1] copy.append([2]) print(original, [3])
Copy original to copy, append "s" to copy, then print both strings separately.