Skip to content

Instantly share code, notes, and snippets.

@Luis-Herrera1207
Created February 6, 2025 18:52
Show Gist options
  • Save Luis-Herrera1207/ee4cd202ed619471b638facaa4611ce1 to your computer and use it in GitHub Desktop.
Save Luis-Herrera1207/ee4cd202ed619471b638facaa4611ce1 to your computer and use it in GitHub Desktop.
Funcion de Parametros Opcionales
//FUNCIONES BASICAS QUE NO DEVUELVEN VALOR, SOLO EJECUTA INSTRUCCIONES
void saludar(String nombre, [String? mensaje]) {
print('Hola, $nombre. ${mensaje ?? ''}');
}
void mostrarDatos({String? nombre, int? edad}) {
print('Nombre: $nombre, Edad: $edad');
}
void main() {
print("HERRERA LUIS 22308051281207");
saludar('Luis Herrera');
mostrarDatos(nombre: 'Luis', edad: 17);
}
@Luis-Herrera1207
Copy link
Author

-SALIDA

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment