Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#00 - Dart #7547

Merged
merged 6 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// https://dart.dev/

// Comentario simple
/**Comentario multiple */
/// Comentario de documentacion
///


void main(List<String> args) {
const String nombre = 'Liatoga';
int edad = 0;
double altura = 0.0;
bool isNumber = false;
dynamic variable = 'Hola';
Future future = Future.delayed(Duration(seconds: 1), () => 'Hola');
print('Hola, Dart');
}

100 changes: 100 additions & 0 deletions Roadmap/01 - OPERADORES Y ESTRUCTURAS DE CONTROL/dart/Lia-M3dusa.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
void main() {
// Operadores Aritméticos
int a = 10, b = 3;
print("Aritméticos:");
print("Suma: \${a + b}");
print("Resta: \${a - b}");
print("Multiplicación: \${a * b}");
print("División: \${a / b}");
print("División Entera: \${a ~/ b}");
print("Módulo: \${a % b}");

// Operadores Lógicos
bool x = true, y = false;
print("\nLógicos:");
print("AND: \${x && y}");
print("OR: \${x || y}");
print("NOT: \${!x}");

// Operadores de Comparación
print("\nComparación:");
print("Igualdad: \${a == b}");
print("Desigualdad: \${a != b}");
print("Mayor que: \${a > b}");
print("Menor que: \${a < b}");
print("Mayor o igual: \${a >= b}");
print("Menor o igual: \${a <= b}");

// Operadores de Asignación
int c = 5;
print("\nAsignación:");
print("Inicial: \${c}");
c += 3;
print("Suma y asigna: \${c}");
c *= 2;
print("Multiplica y asigna: \${c}");

// Operadores de Identidad
print("\nIdentidad:");
print("Idéntico: \${a == 10}");
print("No Idéntico: \${b != 10}");

// Operadores de Bits
print("\nBits:");
print("AND binario: \${a && b}");
print("OR binario: \${a || b}");
print("XOR binario: \${a ^ b}");
print("Desplazamiento izquierda: \${a << 1}");
print("Desplazamiento derecha: \${a >> 1}");

// Estructuras de Control: Condicionales
print("\nCondicionales:");
if (a > b) {
print("a es mayor que b");
} else {
print("a no es mayor que b");
}

// Estructuras de Control: Iterativas
print("\nIterativas:");
print("Bucle For:");
for (int i = 0; i < 5; i++) {
print("i: \${i}");
}

print("Bucle While:");
int count = 0;
while (count < 3) {
print("count: \${count}");
count++;
}

print("Bucle Do-While:");
int num = 0;
do {
print("num: \${num}");
num++;
} while (num < 2);

// Estructuras de Control: Excepciones
print("\nExcepciones:");
try {
int result = a ~/ 0;
print("Resultado: \${result}");
} catch (e) {
print("Error: División por cero");
} finally {
print("Bloque finally ejecutado");
}

// Dificultad Extra
print("\nNúmeros entre 10 y 55 (pares, no 16 ni múltiplos de 3):");
for(int i = 10; i<=55;i++){
if(i == 16 || i % 3 == 0){
continue;
}
if(i.isEven){
print("\${i}");
}
}
}
61 changes: 61 additions & 0 deletions Roadmap/02 - FUNCIONES Y ALCANCE/dart/Lia-M3dusa.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

void ExamplePrint(){
print("Hello World");
}

int sum(int a, int b){
return a + b;
}

int substract(int a, int b){
return a - b;
}

int twoString(String a, String b){
int contenoNumeros = 0;

for(int i=1; i<=100; i++){
if (i % 3 == 0){
print(a);
}else if(i % 3 == 0 && i % 5 == 0){
print(a + b);

}
else if (i % 5 == 0){
print(b);
}else{
print(i);
contenoNumeros++;
}
}
return contenoNumeros;
}

//variable global
String global = "esto es global";

void main(List<String> args) {

//Variable local
String local= "esto es local";

//Funcion anidada
void fExternal(){
void fInternal(){
print("Esto es interna");
}
print("Esto es externa");
fInternal();
}
fExternal();

//Funciones
ExamplePrint();
print(sum(5, 5));
print(substract(5, 5));
print(global);
print(local);

//Funcion que recibe dos strings y un numero
print(twoString("Fizz", "Buzz"));
}