Greetings 👋,
I've constructed 5 basic Swift challenges and listed them below. First, you'll find the challenges and further down the page you'll find the solutions. If you aren't able to solve them, before looking at the solutions, try to find some help through a Google search or at https://developer.apple.com/documentation/swift
Have fun :)
Create a variable named greeting, assign it to the String hello, and print it to the console
Create a constant named pi and assign it to the Double 3.14, and print it to the console
Create a multiline string with the sentence - I love to eat, eat, eat, apples and bananas
Count the amount of characters in the multiline string
Print the multiline string in uppercase letters
*
*
*
*
*
*
*
*
*
*
- Create a variable named greeting, assign it to the String hello, and print it to the console
var greeting = "hello"
print(greeting)
-
Create a constant named pi and assign it to the Double 3.14, and print it to the console
let pi = 3.14
print(pi) -
Create a multiline string with the sentence - I love to eat, eat, eat, apples and bananas
var eatWhat = """
I love to
eat, eat, eat,
apples and bananas.
""" -
Count the amount of characters in the multiline string
print(eatWhat.count)
-
Print the multiline string in uppercase letters
print(eatWhat.uppercased())
Top comments (0)