Секція 3. Розділ 4
single
Challenge: Apply Safe Execution Patterns
Свайпніть щоб показати меню
Завдання
Swipe to start coding
Refactor the divideNumbers function to use safe execution patterns for division in PHP.
- Validate that both
numeratoranddenominatorare numbers. - If either argument is not a number, throw an
InvalidArgumentException. - If
denominatoris zero, throw aDivisionByZeroError. - If validation passes, return the result of dividing
numeratorbydenominator.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 3. Розділ 4
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат