repl.it
@K0DYungDeku/

Swift Playground

Swift

No description

fork
loading
Files
  • main.swift
main.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//Print to console
print("Hello, World!")

//Variables
//"var variableName" makes a variable
//"let variableName" makes a constant
  //Constants must have a value before being compiled
//Constants and variables must have the same type that is assigned to it
  //You do not need to set the type explicitly
  //Setting the value lets Swift assume the type
  
var hello = "Hello"
var world = "World"
let helloWorld = "Helo, World!"

print("--" + hello + world)

let cats = 2
let dogs = 5
var pets =  cats + dogs

print("--I have " + String(pets) + " pets")

Fetching token
?