Liberar recursos en condicionales
This commit is contained in:
1 parent
2e8c5cae24
commit
42ccb65310
3 files changed
+5
No files matched your search
@@ -14,11 +14,13 @@ void main() {
|
|||||||
|
|
||||||
if (!(ano >= 1970 && ano < 3000)) {
|
if (!(ano >= 1970 && ano < 3000)) {
|
||||||
System.out.println("Fecha inválida");
|
System.out.println("Fecha inválida");
|
||||||
|
sc.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(mes > 0 && mes <= 12)){
|
if (!(mes > 0 && mes <= 12)){
|
||||||
System.out.println("Fecha inválida");
|
System.out.println("Fecha inválida");
|
||||||
|
sc.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,6 +43,7 @@ void main() {
|
|||||||
|
|
||||||
if (!(dia > 0 && dia <= diasMaximo)) {
|
if (!(dia > 0 && dia <= diasMaximo)) {
|
||||||
System.out.println("Fecha inválida");
|
System.out.println("Fecha inválida");
|
||||||
|
sc.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
System.out.println("Fecha válida");
|
System.out.println("Fecha válida");
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ void main() {
|
|||||||
case '/':
|
case '/':
|
||||||
if (n2 == 0){
|
if (n2 == 0){
|
||||||
System.out.println("Imposible dividir entre 0");
|
System.out.println("Imposible dividir entre 0");
|
||||||
|
sc.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result = n1 / n2;
|
result = n1 / n2;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ void main() {
|
|||||||
s = sc.nextInt();
|
s = sc.nextInt();
|
||||||
if (h >= 24 || m >= 60 || s >= 60){
|
if (h >= 24 || m >= 60 || s >= 60){
|
||||||
System.out.println("Error: Hora inválida");
|
System.out.println("Error: Hora inválida");
|
||||||
|
sc.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
s++;
|
s++;
|
||||||
|
|||||||
Reference in new issue
Block a user