Bản mẫu:TryCatch/doc

Bách khoa toàn thư mở Wikipedia

This metatemplate simplifies implementing fallback output if an error occurs due to incorrect input. It returns the first parameter if it does not contain an error (using the #iferror parser function), and the second parameter (or the empty string) otherwise.

Cách sử dụng[sửa mã nguồn]

  • {{TryCatch|{{#expr: 1/2}}|Đầu vào không chính xác}} → 0.5
  • {{TryCatch|{{#expr: 1/0}}|Đầu vào không chính xác}} → Đầu vào không chính xác

Xem thêm[sửa mã nguồn]