@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
let check : bool = true ; // suppose que c'est vrai | let check : bool = true ; // suppose que c'est vrai | ||||
assert ! (check == true) ; // vérifier l'erreur | assert ! (check == true) ; // vérifier l'erreur | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
let check : bool = false ; // suppose que c'est faux | let check : bool = false ; // suppose que c'est faux | ||||
assert ! (check == true) ; // vérifier l'erreur | assert ! (check == true) ; // vérifier l'erreur | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
println ! ("Bonjour, monde !") ; | println ! ("Bonjour, monde !") ; | ||||
} | } |
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { // définit une fonction nommée main | fn main() { // définit une fonction nommée main | ||||
println ! ("Bonjour, monde ! ") ; | println ! ("Bonjour, monde ! ") ; | ||||
/* println!( ) est une commande utilisée pour afficher du contenu ou du texte. | /* println!( ) est une commande utilisée pour afficher du contenu ou du texte. | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
let var = "OK" ; | let var = "OK" ; | ||||
println! ("La valeur de var est : { }", var); | println! ("La valeur de var est : { }", var); | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let var : i32 = 100 ; | let var : i32 = 100 ; | ||||
let str : String = "Bonne".to_string() ; | let str : String = "Bonne".to_string() ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let x = 100 ; | let x = 100 ; | ||||
let y = 200 ; | let y = 200 ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
const NUM : i32 = 100 ; | const NUM : i32 = 100 ; | ||||
fn main() { | fn main() { | ||||
println ! ("La valeur de NUM est {}", NUM) ; | println ! ("La valeur de NUM est {}", NUM) ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let var1 : f32 = 100.88 ; | let var1 : f32 = 100.88 ; | ||||
let var2 : i32 = var1 as i32 ; // var1 devient i32 | let var2 : i32 = var1 as i32 ; // var1 devient i32 | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
funt(100, 200) ; // appelle la fonction | funt(100, 200) ; // appelle la fonction | ||||
} | } | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
let num = funt(100) ; // appelle la fonction | let num = funt(100) ; // appelle la fonction | ||||
println ! ("La valeur de num est : { }", num) ; | println ! ("La valeur de num est : { }", num) ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn foo() -> bool { // spécifier un type de retour | fn foo() -> bool { // spécifier un type de retour | ||||
return true // renvoie une valeur à l'appelant | return true // renvoie une valeur à l'appelant | ||||
} | } | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let (x, y) = (100, 200) ; // liaison de variable | let (x, y) = (100, 200) ; // liaison de variable | ||||
println ! ("La valeur de x est {}", x) ; | println ! ("La valeur de x est {}", x) ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let mut a = 100 ; // liaison de variable | let mut a = 100 ; // liaison de variable | ||||
let mut b = 200 ; | let mut b = 200 ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let x = "hello".to_string() ; | let x = "hello".to_string() ; | ||||
let y = String::from("hello") ; | let y = String::from("hello") ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
println ! ("10 + 2 = {}", 10 + 2) ; | println ! ("10 + 2 = {}", 10 + 2) ; | ||||
println ! ("10 - 2 = {}", 10 - 2) ; | println ! ("10 - 2 = {}", 10 - 2) ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
println ! ("true AND false is {}", true && false) ; | println ! ("true AND false is {}", true && false) ; | ||||
println ! ("true OR false is {}", true || false) ; | println ! ("true OR false is {}", true || false) ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
let x : i32 = 100 ; | let x : i32 = 100 ; | ||||
let y : i32 = 200 ; | let y : i32 = 200 ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
let mut a : [i32 ; 4] = [8 ; 4] ; // créer un tableau | let mut a : [i32 ; 4] = [8 ; 4] ; // créer un tableau | ||||
a[1] = 10 ; | a[1] = 10 ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let a :[f32 ; 4] = [0.1, 0.2, 0.3, 0.4] ; // créer un tableau | let a :[f32 ; 4] = [0.1, 0.2, 0.3, 0.4] ; // créer un tableau | ||||
println ! ("{} {} {} {}",a[0],a[1],a[2],a[3]) | println ! ("{} {} {} {}",a[0],a[1],a[2],a[3]) | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
let num=10 ; | let num=10 ; | ||||
if num==10 { | if num==10 { | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
let x=100 ; | let x=100 ; | ||||
let y=200 ; | let y=200 ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let num = if true { // instruction let-if | let num = if true { // instruction let-if | ||||
100 | 100 | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
let mut num=5 ; | let mut num=5 ; | ||||
loop { // instruction de boucle | loop { // instruction de boucle | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
for num in 5..9 { // "5 .. 9" contient les nombres de 5 à 8 | for num in 5..9 { // "5 .. 9" contient les nombres de 5 à 8 | ||||
println ! ("Cela va durer {} heures", num) ; | println ! ("Cela va durer {} heures", num) ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let mut num=0 ; | let mut num=0 ; | ||||
while num<=8 { // instruction while | while num<=8 { // instruction while | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let t = ("Nous nous levons à", 8,"Heures",true); // crée un tuple | let t = ("Nous nous levons à", 8,"Heures",true); // crée un tuple | ||||
print!("{} {} {} {}\n",t.0,t.1,t.2,t.3 ) ; // accède aux éléments | print!("{} {} {} {}\n",t.0,t.1,t.2,t.3 ) ; // accède aux éléments | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let num:i32 = 3 ; // expression donnée | let num:i32 = 3 ; // expression donnée | ||||
match num { | match num { | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
struct Member { // créer une structure | struct Member { // créer une structure | ||||
id : i32, // member : type | id : i32, // member : type | ||||
name : String, | name : String, | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
struct Square { // crée une structure | struct Square { // crée une structure | ||||
len : i32, | len : i32, | ||||
wid : i32, | wid : i32, | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
enum Langage { // définit un enum | enum Langage { // définit un enum | ||||
JS, // membre | JS, // membre | ||||
Rust, | Rust, | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let x = String::from("E2L") ; // x est propriétaire de "E2L". | let x = String::from("E2L") ; // x est propriétaire de "E2L". | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
let s =String::from("Il fait beau") ; // s est propriétaire | let s =String::from("Il fait beau") ; // s est propriétaire | ||||
// de "Il fait beau". | // de "Il fait beau". | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
let s=String :: from("Vive le Rust !"); | let s=String :: from("Vive le Rust !"); | ||||
let n=cal( &s ); // reference | let n=cal( &s ); // reference | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
mod mon_module { // définit un module | mod mon_module { // définit un module | ||||
pub fn test(){ // pub signifie attribut public | pub fn test(){ // pub signifie attribut public | ||||
println ! ("Bonjour mes amis ! ") ; | println ! ("Bonjour mes amis ! ") ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
mod m1{ | mod m1{ | ||||
pub fn a(){ | pub fn a(){ | ||||
println ! ("module m1") ; | println ! ("module m1") ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
pub fn ex_fun() { | pub fn ex_fun() { | ||||
println ! ("{}", "Texte externe") ; | println ! ("{}", "Texte externe") ; | ||||
} | } |
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
mod ex6_3 ; // charge un fichier externe | mod ex6_3 ; // charge un fichier externe | ||||
use ex6_3::ex_fun ; // charge une fonction externe | use ex6_3::ex_fun ; // charge une fonction externe | ||||
fn main () { | fn main () { | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
mod mon_module { | mod mon_module { | ||||
pub fn a() { // la fonction est publique | pub fn a() { // la fonction est publique | ||||
println ! ("fonction a") ; | println ! ("fonction a") ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
mod mon_module { | mod mon_module { | ||||
pub fn a() { | pub fn a() { | ||||
println ! ("fonction a") ; | println ! ("fonction a") ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
mod sup_module{ // module parent | mod sup_module{ // module parent | ||||
fn a() -> i32 { | fn a() -> i32 { | ||||
100 | 100 | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
let v = vec ![100, 200, 300, 400] ; // crée un vecteur | let v = vec ![100, 200, 300, 400] ; // crée un vecteur | ||||
println ! ("Le premier élément est : {}",v[0]) ; // accède au premier élément | println ! ("Le premier élément est : {}",v[0]) ; // accède au premier élément | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
let v =vec ! [8 ; 3] ; // répété trois fois | let v =vec ! [8 ; 3] ; // répété trois fois | ||||
println ! ("Le premier élément est : {}",v[0]) ; | println ! ("Le premier élément est : {}",v[0]) ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
let mut v=Vec::new() ; // crée un vecteur | let mut v=Vec::new() ; // crée un vecteur | ||||
v . push('R') ; // définit R comme le premier élément du vecteur | v . push('R') ; // définit R comme le premier élément du vecteur | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let num = 3 ; | let num = 3 ; | ||||
match num { | match num { | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let x = 3 ; | let x = 3 ; | ||||
match x { | match x { | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let x = 5 ; | let x = 5 ; | ||||
match x { | match x { | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let x : Option<bool> = Some(true) ; // paramètres génériques | let x : Option<bool> = Some(true) ; // paramètres génériques | ||||
let y : Option<i32> = Some(10) ; | let y : Option<i32> = Some(10) ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
struct Circle{ // création d'une structure de type | struct Circle{ // création d'une structure de type | ||||
radius : f32, // membre de la structure | radius : f32, // membre de la structure | ||||
} | } | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
struct Cercle{ // créez une structure de type | struct Cercle{ // créez une structure de type | ||||
rayon : f32, // membre de la structure | rayon : f32, // membre de la structure | ||||
} | } | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
pub trait Show { // définit un trait | pub trait Show { // définit un trait | ||||
fn show(&self) ; // définition d'une méthode de trait | fn show(&self) ; // définition d'une méthode de trait | ||||
} | } | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
struct Jeu { | struct Jeu { | ||||
numero : i32, | numero : i32, | ||||
} | } | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main(){ | fn main(){ | ||||
let ma_fermeture = | num : i32 | { num+200 }; //crée une fermeture | let ma_fermeture = | num : i32 | { num+200 }; //crée une fermeture | ||||
let num = 100 ; | let num = 100 ; | ||||
@@ -1,3 +1,20 @@ | |||||
/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry | |||||
Ecole du Logiciel Libre : https://e2li.org/ | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or any | |||||
later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
fn main() { | fn main() { | ||||
let mut capacity = "Capacité du disque dur : 5000".to_string() ; | let mut capacity = "Capacité du disque dur : 5000".to_string() ; | ||||
{ | { | ||||