Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

🔁 Swift Basics: Loops

A concise, runnable Xcode playground exploring for, while, and repeat-while loops in Swift

Platform Swift Xcode Stars Last Commit

📖 Overview

Loops let you run a block of code repeatedly — over a range, over the elements of a collection, or until a condition changes. This is a small, self-contained Swift playground that demonstrates the three core looping constructs in Swift and can be run directly in Xcode to see the printed output.

It is meant as a concise learning example, not a library or app.

✨ What it covers

  • for-in over a range — iterating a closed range (9...15) and printing each index.
  • for-in over a collection — looping through the elements of an array of strings.
  • for-in over a string — iterating each character of a String.
  • for-in over a numeric array — visiting each element of [Int].
  • while loop — repeating while a condition holds, incrementing a counter until it exits.
  • repeat-while loop — running the body at least once before evaluating the condition.

🚀 Getting Started

git clone https://github.com/ahmetbostanciklioglu/Loops.git
cd Loops

Unzip Loops.playground.zip, open Loops.playground in Xcode, and run it to view the results in the console and the results sidebar.

📋 Requirements

  • Xcode 12 or later
  • Swift 5
  • macOS with the iOS playground platform

🧑‍💻 Author

Ahmet Bostancıklıoğlu@ahmetbostanciklioglu · ahmetbostancikli@gmail.com

⭐ If this helped you, consider giving the repo a star!

About

A concise Swift playground demonstrating for-in, while, and repeat-while loops — a beginner learning example.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors