MCPcopy Create free account

hub / github.com/WayLearnLatam/Learning-Rust / functions

Functions17 in github.com/WayLearnLatam/Learning-Rust

↓ 3 callersFunctioninformacion_mascota
(mascota: Mascota)
7_structs_y_enums/src/main.rs:105
↓ 1 callersFunctionfuncion_de_prueba
()
4_funciones/src/main.rs:27
↓ 1 callersFunctionimprimir_numero
(n: i32)
5_ownership/src/main.rs:58
↓ 1 callersFunctionimprimir_referencia
(s: &String)
5_ownership/src/main.rs:85
↓ 1 callersFunctionimprimir_string
(s: String)
5_ownership/src/main.rs:65
↓ 1 callersFunctionmodificar_string
(s: &mut String)
5_ownership/src/main.rs:97
Functioncalculadora
Tomando en cuenta lo visto anteriormente crearemos una funcion que realice diferentes operaciones: 1. suma 2. resta 3. multiplicacion 4. division
4_funciones/src/main.rs:59
Functionfuncion_suma
Las funciones pueden incluir parametros, es decir, pedir valores con los cuales trabajar e interactuar. Esto es de bastante utilidad cuando deseas se
4_funciones/src/main.rs:41
Functionfuncion_suma_p
Para retornar un valor es necesario especificar el tipo de dato retornado mediante "->" despues de los parentesis, aunque tambien es posible hacerlo
4_funciones/src/main.rs:48
Functionimprimir_y_devolver_string
s se libera aquí hacer esto deja a la variable "palabra" sea limpiada, para evitarlo es necesario devolver el valor de la variable antes de finalizar
5_ownership/src/main.rs:70
Functionmain
()
3_control_de_flujo_y_ciclos/src/main.rs:1
Functionmain
()
5_ownership/src/main.rs:13
Functionmain
()
2_tipos_de_variable/src/main.rs:1
Functionmain
()
6_colecciones/src/main.rs:3
Functionmain
()
7_structs_y_enums/src/main.rs:36
Functionmain
()
4_funciones/src/main.rs:6
Methodsuma
Uso de implementaciones con struct Object method, permite aplicar funciones haciendo uso de los valores del struct de fomra directa:
7_structs_y_enums/src/main.rs:17