40 lines
891 B
Rust
40 lines
891 B
Rust
use std::thread;
|
|
use std::time::Duration;
|
|
|
|
fn rutina_ejercicio(i: u32, a: u32) {
|
|
let cierre = |num| {
|
|
println!("Recalculando...");
|
|
thread::sleep(Duration::from_secs(2));
|
|
num
|
|
};
|
|
if i < 25 {
|
|
println!("Hoy haz {} sentadillas", cierre(i));
|
|
println!("Despues haz {} sentadillas", cierre(i));
|
|
} else {
|
|
if a == 3 {
|
|
println!("Descansa un poco y recuerda hidratarte");
|
|
} else {
|
|
println!("Hoy corre por {} minutos", cierre(i));
|
|
}
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let valor_especificado = 27;
|
|
let numero_al_azar = 5;
|
|
|
|
rutina_ejercicio(valor_especificado, numero_al_azar);
|
|
|
|
// ejemplo creado por mi
|
|
|
|
let imprime_algo = |texto| {
|
|
println!("WTF!!!!!");
|
|
texto
|
|
};
|
|
|
|
println!(
|
|
"Vamos a imprimir el texto....{}",
|
|
imprime_algo("Mis cojones mangas 3")
|
|
)
|
|
}
|