Skip to content

Instantly share code, notes, and snippets.

@VictorAlemanHidalgo
Created February 6, 2025 19:00
Show Gist options
  • Save VictorAlemanHidalgo/ada24df84efc000e540a76893f61c8f4 to your computer and use it in GitHub Desktop.
Save VictorAlemanHidalgo/ada24df84efc000e540a76893f61c8f4 to your computer and use it in GitHub Desktop.
Funcion con parametros opcionales
// Parametros opcionales posicionales
void saludar(String nombre, [String? mensaje]) {
print('Hola $nombre, ${mensaje ?? ''}');
}
void mostrarDatos({String? nombre, int? edad}) {
print("¡Hola, ${nombre}. Tu edad es: ${edad}!");
}
void main() {
print(" Victor Aleman Hidalgo 20308051281123 ");
saludar("Victor");
saludar("Victor", "Como estas?");
mostrarDatos(nombre: "Victor", edad: 12);
}
@VictorAlemanHidalgo
Copy link
Author

Salida
image

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