Dart编程实例 - 自定义异常
本文为大家分享 Dart编程实例 - 自定义异常 的具体示例代码,提供大家参考,具体内容如下:
class AmtException implements Exception { String errMsg() => 'Amount should be greater than zero'; } void main() { try { withdraw_amt(-1); } catch(e) { print(e.errMsg()); } finally { print('Ending requested operation.....'); } } void withdraw_amt(int amt) { if (amt <= 0) { throw new AmtException(); } }
本文为大家分享 Dart编程实例 - 添加断点 的具体示例代码,提供大家参考,具体内容如下:void main() { int a = 10, b = 20, c = 5; c = c * c * c; pr ...