This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Ejercicio 1 - Suma de Números Pares: | |
Escribe una función que tome un número n | |
como parámetro y devuelva la suma de todos | |
los números pares desde 1 hasta n. | |
* | |
* */ | |
/// Como hallar un número par?: | |
/// % => Operador módulo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// NULL Safety | |
/// Característica de Dart que ayuda a | |
/// prevenir error de valor nullo. | |
class Persona { | |
String nombre; | |
String? apodo; | |
Persona({required this.nombre, this.apodo}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mascota { | |
String nombre; | |
String color; | |
int edad; | |
bool sexo; | |
Mascota({ | |
required this.nombre, | |
required this.color, | |
required this.edad, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Persona { | |
String nombre; | |
String dni; | |
Persona(this.nombre, this.dni); | |
} | |
class CuentaBancaria { | |
String numero; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Rectangulo { | |
double largo; | |
double ancho; | |
Rectangulo({required this.largo, required this.ancho}); | |
double calcularArea() { | |
return largo * ancho; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Programación Orienta a Objetos | |
/// CLASE: Una plantilla para crear objetos. | |
/// Sintaxis: | |
/// class NombreDeLaClase { | |
/// String propiedad1; | |
/// int propiedad2; | |
/// | |
/// NombreDeLaClase() { | |
/// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
///FOR -IN: | |
///final List<int> numeros = [1, 3, 4, 6, 2, 37, 1, 4]; | |
/// For Convencional | |
/* for(int i = 0; i < numeros.length; i++) { | |
print(numeros[i]); | |
}*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Implementa una función que tome una | |
/// lista de nombres y devuelva el nombre | |
/// más largo. | |
void main() { | |
final List<String> nombres = [ | |
'EDDIE', | |
'CARLOS FARRO', | |
'KATERIN', | |
'JOSEPH', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Crea una función llamada | |
/// calcularPromedio que tome una lista | |
/// de números como parámetro y | |
/// devuelva el promedio de esos números. | |
void main() { | |
final List<int> notas = [34, 32, 5, 3, 12, 6, 8]; | |
print('El promedio de las notas es: ${calcularPromedio(notas)}'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// FUNCIONES !!! | |
/// 1. Las funciones permiten encapsular | |
/// un conjunto de instrucciones | |
/// en un bloque reutilizable. | |
/// 2. Pueden aceptar parámetros de entrada. | |
/// 3. Pueden devolver un valor como resultado | |
/// (o simplemente ejecutar un conjunto de |