Skip to content

Commit 69c3028

Browse files
committed
Merge branch 'main' of github.com:DaniRojasDev/roadmap-retos-programacion
2 parents 8ec1564 + 11aca55 commit 69c3028

File tree

10 files changed

+1981
-1303
lines changed

10 files changed

+1981
-1303
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//------------------------------------------------------------------------------------
2+
/*
3+
1. Crea un comentario en el código y coloca la URL del sitio web oficial del
4+
lenguaje de programación que has seleccionado.
5+
*/
6+
7+
//Sitio oficial de C#: https://learn.microsoft.com/en-us/dotnet/csharp/
8+
9+
//------------------------------------------------------------------------------------
10+
/*
11+
2. Representa las diferentes sintaxis que existen de crear comentarios
12+
en el lenguaje(en una línea, varias...).
13+
*/
14+
15+
//Esto es un comentario de una línea
16+
17+
/*Esto es un comentario de
18+
varias líneas*/
19+
20+
//------------------------------------------------------------------------------------
21+
/*
22+
3. Crea una variable(y una constante si el lenguaje lo soporta).
23+
*/
24+
25+
int entero = 1;
26+
const int Max_Items = 15;
27+
28+
//------------------------------------------------------------------------------------
29+
30+
/*
31+
4. Crea variables representando todos los tipos de datos primitivos
32+
del lenguaje(cadenas de texto, enteros, booleanos...).
33+
*/
34+
35+
//Enteros
36+
byte byteVar = 255;
37+
sbyte sbyteVar = -128;
38+
short shortVar = 32767;
39+
ushort ushortVar = 65535;
40+
int intVar = 2147483647;
41+
uint uintVar = 4294967295;
42+
long longVar = 9223372036854775807L;
43+
ulong ulongVar = 18446744073709551615UL;
44+
45+
//Punto flotante
46+
float floatVar = 3.14f;
47+
double doubleVar = 3.14159265359;
48+
decimal decimalVar = 3.14159265359m;
49+
50+
// Booleano
51+
bool boolVar = true;
52+
53+
// Caracteres y cadenas
54+
char charVar = 'A';
55+
string stringVar = "Hola mundo";
56+
57+
// Fecha y hora
58+
DateTime dateTimeVar = DateTime.Now;
59+
60+
//------------------------------------------------------------------------------------
61+
/*
62+
5. Imprime por terminal el texto: "¡Hola, [y el nombre de tu lenguaje]!"
63+
*/
64+
65+
Console.WriteLine("¡Hola, C#!");
66+
67+
//------------------------------------------------------------------------------------
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/* EJERCICIO:
2+
Crea un comentario en el código y coloca la URL del sitio web oficial
3+
del lenguaje de programación que has seleccionado.
4+
*/
5+
6+
// Javascript official website: https://www.javascript.com/
7+
8+
// Representa las diferentes sintaxis que existen de crear comentarios en el lenguaje (en una línea, varias...)
9+
// ** Single line comment **
10+
// This is a single line comment
11+
// ** Multi-Line comment **
12+
/* This is a multi-line comment
13+
This is a multi-line comment
14+
This is a multi-line comment
15+
*/
16+
17+
18+
// Crea una variable (y una constante si el lenguaje lo soporta).
19+
// Auto-declared variable
20+
auto_declared_variable = 5;
21+
// Using var
22+
var year = 2025;
23+
// Using let
24+
let month = 'January';
25+
// Using const
26+
const day = 17;
27+
28+
// Crea variables representando todos los tipos de datos primitivos del lenguaje (cadenas de texto, enteros, booleanos...).
29+
// Strings
30+
let first_name = 'Brandon';
31+
let last_name = "Cavero";
32+
// Number
33+
let random_number = 123;
34+
// Float or BigInt
35+
let pi_number = 3.14;
36+
// Boolean
37+
let is_sunny = true;
38+
// Undefined
39+
let undefined_value;
40+
41+
// Imprime por terminal el texto: "¡Hola, [y el nombre de tu lenguaje]!"
42+
console.log('Hello, Javascript!');
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# http://python.org
2+
3+
# Comentario en una linea
4+
5+
"""
6+
Esto es
7+
un comentario
8+
en varias lineas
9+
"""
10+
11+
'''
12+
Esto tambien es
13+
un comentario
14+
en varias lineas
15+
'''
16+
17+
my_variable = "Mi variable"
18+
my_variable = "Nuevo valor de mi variable"
19+
20+
MY_CONSTANT = "Mi constante" # por convencion
21+
22+
my_int = 1
23+
my_float= 1.5
24+
my_bool = True
25+
my_bool = False
26+
my_string = "Mi cadena de texto"
27+
my_other_string = 'Mi otra cadena de texto'
28+
29+
print("Hola, Python!")
30+
31+
print(type(my_int))
32+
print(type(my_float))
33+
print(type(my_bool))
34+
print(type(my_string))
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# https://www.python.org/
2+
3+
"""
4+
comentario en varias lineas
5+
"""
6+
''' tambien es un comentario
7+
'''
8+
variable = "esta es una variable"
9+
variable = "Nuevo valor a variable"
10+
constantes = "no hay constantes en python"
11+
# constantes por convencion se nombran con mayusculas
12+
MI_CONSTANTE = "CONSTANTE"
13+
texto ="esto es texto"
14+
entero = 3
15+
decimal = 3.0
16+
booleano = False
17+
print ('Hola, Python')
18+
print(type(variable)
19+
print(type(entero)
20+
print(type(decimal)
21+
print(type(booleano)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
-- https://www.sql.org/
2+
3+
-- Comentario en una linea
4+
5+
/* Comentario en
6+
varias lineas
7+
*/
8+
9+
DECLARE @my_var VARCHAR(50);
10+
SET @my_var = 'Esta es la variable';
11+
12+
-- Datos Primitivos
13+
DECLARE @type_numeric INTEGER;
14+
SET @type_numeric = 14;
15+
16+
DECLARE @type_real REAL;
17+
SET @type_real = 10.5;
18+
19+
DECLARE @type_char CHAR;
20+
SET @type_char = 'sinEspacios';
21+
22+
DECLARE @type_varchar VARCHAR;
23+
SET @type_varchar = 'Con espacios';
24+
25+
DECLARE @type_boolean BOOLEAN;
26+
SET @type_boolean = true;
27+
28+
DECLARE @type_date DATE;
29+
SET @type_date = '2024-04-21';
30+
31+
DECLARE @type_time TIME;
32+
SET @type_time = '23:57:10';
33+
34+
DECLARE @type_timestamp TIMESTAMP;
35+
SET @type_char = '2025-01-20 23:58:02';
36+
37+
PRINT "Hola, SQL";
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
//https://www.typescriptlang.org/
2+
3+
4+
// Declaración de variables con tipos de datos
5+
6+
/** comentar un documento
7+
* multilinea de comentarios en TypeScrpt
8+
* puedo seguir escribiendo
9+
*/
10+
//comentar una sola linea
11+
12+
/*
13+
comentar varias lineas
14+
en TypeScript
15+
*/
16+
//number
17+
18+
let edad: number = 25;
19+
//declarar una constante
20+
const edad3: number = 30;
21+
22+
// Cadena de texto
23+
const nombre: string = "Juan";
24+
25+
// Booleano
26+
const esEstudiante: boolean = true;
27+
// Arreglo de números
28+
29+
// Tupla
30+
let persona: [string, number] = ["Juan", 25];
31+
32+
// Enumeración
33+
enum Color {
34+
Rojo,
35+
Verde,
36+
Azul
37+
}
38+
let colorFavorito: Color = Color.Verde;
39+
40+
// Any (puede ser cualquier tipo de dato)
41+
let variableIndefinida: any = "Hola";
42+
variableIndefinida = 10;
43+
44+
// Void (usualmente para funciones que no retornan valor)
45+
function saludar(): void {
46+
console.log("Hola, mundo!");
47+
}
48+
49+
// Null y Undefined
50+
let variableNula: null = null;
51+
let variableIndefinida2: undefined = undefined;
52+
53+
// Object
54+
let personaObj: { nombre: string, edad: number } = { nombre: "Juan", edad: 25 };
55+
56+
console.log('Hola TypeScript!');
57+
58+
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/*
2+
EJERCICIO:
3+
- Crea ejemplos utilizando todos los tipos de operadores de tu lenguaje:
4+
Aritméticos, lógicos, de comparación, asignación, identidad, pertenencia, bits...
5+
(Ten en cuenta que cada lenguaje puede poseer unos diferentes)
6+
*/
7+
8+
// Arithmetics operators
9+
const first_num = 5;
10+
const second_num = 6;
11+
12+
let sum = first_num + second_num; // Addition
13+
let subs = second_num - first_num; // Substraction
14+
let mul = first_num * second_num; // Multiplication
15+
let div = second_num / 2; // Division
16+
let rem = second_num % 2; // Remainder
17+
18+
// Logical operators
19+
const first_bool = true;
20+
const second_bool = false;
21+
22+
let and_operator = first_bool && second_bool; // AND
23+
let or_operator = first_bool || second_bool; // OR
24+
let not_operator = !(first_bool); // NOT
25+
26+
// Comparison operators, identity operators
27+
let equal_to = first_bool == 5; // Equal to
28+
let equal_value = first_bool === '5'; // Equal value
29+
let not_equal = first_bool != 5; // Not equal to
30+
let not_equal_value = first_bool !== '5'; // Not equal value
31+
let greater_than = first_bool > second_bool; // Greater than
32+
let less_than = first_bool < second_bool; // Less than
33+
let greater_or_equal = first_bool >= 5; // Greater than or equal to
34+
let less_or_equal = first_bool <= 5; // Less than or equal to
35+
36+
37+
// Assignment operators
38+
let simple_assignment = 5; // Simple assignment
39+
let addition_assignment = 5;
40+
addition_assignment += 10; // Addition assignment
41+
let substraction_assignment = 10;
42+
substraction_assignment -= 5; // Substraction assignment
43+
let multiplication_assignment = 10;
44+
multiplication_assignment *= 5; // Multiplication assignment
45+
let exponential_assignment = 10;
46+
exponential_assignment **= 2; // Exponential assignment
47+
let division_assignment = 10;
48+
division_assignment /= 5; // Division assignment
49+
let remainder_operator = 10;
50+
remainder_operator %= 2; // Remainder assignment
51+
52+
// Bitwise operators
53+
let and_bit_operator = first_bool & second_bool; // And
54+
let or_bit_operator = first_bool | second_bool; // Or
55+
let xor_bit_operator = first_bool ^ second_bool; // Xor
56+
57+
let bit_const = 7
58+
let zero_fill_left = bit_const << 1; // Zero fill left shift
59+
let signed_right_shift = bit_const >> 1; // Signed right shift
60+
61+
/*
62+
- Utilizando las operaciones con operadores que tú quieras, crea ejemplos
63+
que representen todos los tipos de estructuras de control que existan
64+
en tu lenguaje:
65+
- Condicionales, iterativas, excepciones...
66+
- Debes hacer print por consola del resultado de todos los ejemplos.
67+
*/
68+
console.log('*********** If ***********');
69+
let condition = true;
70+
if (condition) {
71+
console.log('The condition is "true" so this will be printed');
72+
}
73+
else if (condition == false) {
74+
console.log('This should be printed if the condition is "false"');
75+
}
76+
else if (condition == '0') {
77+
console.log('This condition should be printed if the value of condition is "0"');
78+
}
79+
80+
console.log('*********** For ***********');
81+
for (let i = 0; i < 5; i++) {
82+
console.log('Counting using a for loop: ' + i);
83+
}
84+
85+
console.log('*********** While ***********');
86+
let while_condition = 5;
87+
while (while_condition > 0) {
88+
console.log('Counting using a while loop: ' + while_condition);
89+
while_condition -= 1;
90+
}
91+
92+
console.log('*********** Try - Catch ***********');
93+
try {
94+
nonExistingFunction();
95+
}
96+
catch (error) {
97+
console.error('This is being printed because of the error: '+ error)
98+
}
99+
100+
/*
101+
* DIFICULTAD EXTRA (opcional):
102+
* Crea un programa que imprima por consola todos los números comprendidos
103+
* entre 10 y 55 (incluidos), pares, y que no son ni el 16 ni múltiplos de 3.
104+
*
105+
* Seguro que al revisar detenidamente las posibilidades has descubierto algo nuevo.
106+
*/
107+
108+
for (i = 10; i < 56; i++) {
109+
if (! (i == 16 || i % 3 == 0) && (i % 2 == 0) || (i == 55)) {
110+
console.log(i)
111+
}
112+
}
113+

0 commit comments

Comments
 (0)