0
0
Swiftprogramming~15 mins

What is Swift - Hands-On Activity

Choose your learning style9 modes available
What is Swift
📖 Scenario: You want to learn about Swift, a programming language used to create apps for Apple devices like iPhones and Macs.
🎯 Goal: Understand what Swift is and see a simple example of Swift code that prints a message.
📋 What You'll Learn
Create a variable with a welcome message about Swift
Create a constant with the year Swift was introduced
Write a function that prints the welcome message
Call the function to show the message
💡 Why This Matters
🌍 Real World
Swift is used by developers to create apps for iPhones, iPads, Macs, Apple Watches, and Apple TVs.
💼 Career
Knowing Swift is important for jobs in app development for Apple platforms, which are popular worldwide.
Progress0 / 4 steps
1
Create a welcome message variable
Create a variable called welcomeMessage and set it to the string "Welcome to Swift programming!"
Swift
Need a hint?

Use var to create a variable and assign the string with =.

2
Add a constant for Swift's introduction year
Create a constant called swiftYear and set it to the number 2014
Swift
Need a hint?

Use let to create a constant and assign the number 2014.

3
Write a function to print the welcome message
Write a function called showWelcome that prints the variable welcomeMessage
Swift
Need a hint?

Use func to define the function and print() to show the message.

4
Call the function to display the message
Call the function showWelcome() to print the welcome message
Swift
Need a hint?

Just write showWelcome() to run the function.