Dart
xxxxxxxxxx
class FoodSpoiledError extends StateError {
FoodSpoiledError(String msg) : super(msg);
}
class Potato {
int age;
Potato(this.age);
String peel() {
if (age > 4) {
throw new FoodSpoiledError('your potato is spoiled');
}
return "peeled";
}
}
main() {
var p = new Potato(7);
try {
p.peel();
} on FoodSpoiledError catch(_) {
print("nope nope nope");
}
try {
throw("potato");
} catch(_) {
print("caught a flying potato");
}
p.peel();
print('not reached');
}
$ dart exceptions.dart nope nope nope caught a flying potato Unhandled exception: Bad state: your potato is spoiled
Linux - anc-api-tools qanday o'rnatiladi
Linux - curvedns qanday o'rnatiladi
Python - Raqamning ijobiy, salbiy yoki 0 ekanligini tekshiring
Linux - zenmap qanday o'rnatiladi
C - Butun sondagi raqamlar sonini sanash
JavaScript - Satr ma'lum belgilar bilan boshlanishi va tugashini tekshiring
C++ - Kabisa yilini tekshiring
C++ - Raqam tub yoki oddiy emasligini tekshiring
C - Dinamik xotira ajratish yordamida eng katta raqamni toping
Kotlin - Raqamni n o‘nlik kasrgacha yaxlitlash
Kotlin - Raqamni teskari aylantirish
Linux - xbitmaps qanday o'rnatiladi
Linux - zstd qanday o'rnatiladi
Linux - zfs-test qanday o'rnatiladi
Kotlin - Sonning faktorialini toping
Java - Raqamni teskari aylantirish
Kotlin - Natural sonlar yig‘indisini hisoblang
Kotlin - Butun sondagi raqamlar sonini sanash
We have been online since 2021 and 1 millions of people around the globe have visited our website since then
More visitors every month