Skip to content

Instantly share code, notes, and snippets.

@ValentinLoya
Last active February 6, 2025 19:14
Show Gist options
  • Save ValentinLoya/cd2185ccb4b78c5948e320f5f4e3ced8 to your computer and use it in GitHub Desktop.
Save ValentinLoya/cd2185ccb4b78c5948e320f5f4e3ced8 to your computer and use it in GitHub Desktop.
funcion con 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("Valentin Loya 22308051281244");
saludar('Valentin Loya');
mostrardatos(nombre: 'Valentin Loya',edad: 17);
}
@ValentinLoya
Copy link
Author

Salida
image

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