Voici votre URL de partage https://sharemycode.io/c/8b790a0 (Cliquer pour copier) (Copié)

import UIKit

let  name: String = "Quentin"
var adresse: String? = "incroyable"

/// \ =opt+maj+/


if adresse == nil {
    print("Hello \(name)")
} else {
    print("J'ai ton adresse \(name)")
}

print( adresse ?? "No adresse")

let students = ["Quentin", "Nico", "Alice"]

for name in students{
    print(name)
}

func SayHello(){
    print("Hello")
}

SayHello()

func SayHello(to name: String, content message: String ) {
    print("Hello \(name) : \(message)")
}
SayHello(to: "moi" ,content: "azfiuegf")

func SayBye(to name: String = "No name") ->String{
    return "Bye \(name)"
}
SayBye(to: "toi")
SayBye()

enum Direction {
    case droite(String)
    case gauche(String)
}

let newDirection: Direction = .droite("par la")
print(newDirection)

class Car{
   var color: String
    private var speed: Int = 0
    
    init(desiredColor: String){
        color = desiredColor
    }
    
    func Drive(NewSpeed: Int){
        speed = NewSpeed
    }
    func GetSpeed()->Int{
        return speed + 5
    }
}

let myFirstCar = Car(desiredColor: "red")
print(myFirstCar.GetSpeed())
myFirstCar.Drive(NewSpeed: 100)
print(myFirstCar.GetSpeed())

struct Bike{
    var color: String
    let speed: Int
}

let myFirstBike = Bike(color: "blouge", speed: 40)
print(myFirstBike)

var YellowCar = Car(desiredColor: "yellow")
var RedCar = Car(desiredColor: "red")

RedCar = YellowCar
YellowCar.color = "Blue"
print(RedCar.color)

var YellowBike = Bike(color: "yellow", speed: 20)
var RedBike = Bike(color: "red", speed: 20)

RedBike  = YellowBike
YellowBike .color = "Blue"
print(RedBike .color)

Informations

Cet extrait a été créé le 24 nov. 2022 à 15:56:54

Cet extrait expire le 24 déc. 2022 à 15:56:54

Langage : swift

Logo swift

Link

Voici votre URL de partage : https://sharemycode.io/c/8b790a0 Copié

Demander la suppression