Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Compile and Execute Swift Online

// let π = 3.14159265359;
// var r = 5;
// var surface = π * Double(r) * Double(r)
// print(surface);


// var tuple = (prenom:"Soufine",nom:"Souhail",age:20);

// print("je m'appelle \(tuple.prenom) \(tuple.nom) J'ai \(tuple.age)");

// var temp ; 
// print("temp est \(temp)");





// var temp : Int?;
// print("temp est \(temp)");
// temp = 0;

// if temp != nil{
//     print("temp est \(temp!)");
// }
// var ville = ["A":"Agadir","R":"Rabat"];
// var resul = ville["B"];
// if let result = ville["B"]{
//     print("temp est \(temp)");
// }

// var answer = 1;
// for _ in 1...10 { answer *= 3 }
// print(answer);

// var ville = ["A":"Agadir","R":"Rabat"];
// for (_,valeur) in ville{
//     print(" - " + valeur)
// }
// var name = ["Mohammed","Mohammed","Soufiane"];
// var dic = [String: Int] ()
// for val in name {
//     if dic[val] == nil{
//         dic[val] = 1
//     }else{
//         dic[val]! += 1
//     }
// }
// print(dic)
// for(key,val) in dic {
//     print("\(key) : \(val)")
// }

class Etudiant {
    var id :Int = 0
    var nom :String = "Bonjour"
    var age:Int = 36
    
    func afficher(){
        print("\(nom) , son age est \(age)")
    }
}
 let etudiant = Etudiant()
 etudiant.afficher()
 

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.