Bahasa Pemrograman Swift (Swift 4.1)
  • Selamat Datang di Swift
  • Tentang Swift
  • Kompatibilitas Versi
  • Sebuah Tur Swift
  • Panduan Bahasa
    • Tentang Referensi Bahasa
    • Struktur Leksikal
    • Tipe
    • Ekspresi
    • Statemen
    • Deklarasi
    • Atribut
    • Pola
    • Parameter Generik dan Argumen
    • Ringkasan Grammar
  • Penuntut Bahasa
    • Dasar-dasar
    • Operator Dasar
    • String dan Karakter
    • Tipe-tipe Koleksi
    • Aliran Kontrol
    • Fungsi
    • Closures
    • Enumerasi
    • Kelas dan Struktur
    • Property
    • Method
    • Subscript
    • Inheritance
    • Inisiasi
    • Deinisiasi
    • Rangkaian Opsional
    • Penanganan Eror
    • Type Casting
    • Tipe Bertumpuk
    • Ekstensi
    • Protokol
    • Generik
    • Automate Reference Counting
    • Keamanan Memori
    • Kontrol Akses
    • Operator Lanjutan
  • Sejarah Revisi
    • Dokumen Sejarah Revisi
  • Hak Cipta
Powered by GitBook
On this page

Sebuah Tur Swift

PreviousKompatibilitas VersiNextPanduan Bahasa

Last updated 7 years ago

CtrlK

Adalah sebuah tradisi bahwa program pertama dari sebuah bahasa pemrograman baru seharusnya menampilkan teks "Hello, world!" pada layar. Dengan Swift, ini bisa dilakukan dengan satu baris:

print("Hello, world!")

If you have written code in C or Objective-C, this syntax looks familiar to you—in Swift, this line of code is a complete program. You don’t need to import a separate library for functionality like input/output or string handling. Code written at global scope is used as the entry point for the program, so you don’t need amain()function. You also don’t need to write semicolons at the end of every statement.

This tour gives you enough information to start writing code in Swift by showing you how to accomplish a variety of programming tasks. Don’t worry if you don’t understand something—everything introduced in this tour is explained in detail in the rest of this book.

NOTE

For the best experience, open this chapter as a playground in Xcode. Playgrounds allow you to edit the code listings and see the result immediately.

Download Playground