Skip to content

Instantly share code, notes, and snippets.

@edutrul
Created December 1, 2018 06:27
Show Gist options
  • Save edutrul/8d3971a3d8de76f5945f04160f6d1e78 to your computer and use it in GitHub Desktop.
Save edutrul/8d3971a3d8de76f5945f04160f6d1e78 to your computer and use it in GitHub Desktop.
void main() {
var a = 5;
var b = 11;
var result = a + b;
print(a);
print(b);
print("Este es el resultado: $result");
if (result % 2 == 0) {
print("$result es par");
}
else {
print("$result es impar");
}
var nota_a = 10;
var nota_b = 15;
if (nota_a > nota_b) {
print('nota a $nota_a es mayor');
}
else if (nota_a < nota_b) {
print('nota b $nota_b es mayor');
}
else if (nota_a == nota_b) {
print("Ambas notas son iguales");
}
print(nota_a > nota_b ? "nota_a es mayor" : "nota_b es mayor");
print(true);
print(false);
print(13+45);
var s1 = '''
Loreum ipsum
Una nueva linea
Otra linea...
''';
print(s1);
var my_list = [24, 40, 30];
print(my_list);
print(my_list[0]);
var person = {
'name': 'Eduardo',
'last_name': 'Telaya'
};
print(person);
for (var i = 4; i >= 0; i--) {
print(i);
}
var i = 5;
do
{
print(i);
i--;
} while(i != -1);
int n=10;
imprimeAsterisco(n);
}
void imprimeAsterisco(int n){
var list= List(n);
list[0] ='*';
// Carga listado.
for (int i = 1;i < n; i++) {
list[i] = '*' + list[i-1];
}
// Imprimir el listado ascendente.
for (int i=0;i<n;i++)
print(list[i]);
// Imprimir el listado de manera descendente.
for (int i = n-2;i >=0; i--) {
print(list[i]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment