diff --git a/README.md b/README.md index 5cef420..94a6109 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Read the [documentation](https://doc.maybe.texthtml.net) full API description, d * @return Option */ function divide(float $numerator, float $denominator): Option { - return match ($denomintor) { + return match ($denominator) { 0.0 => Option\none(), default => Option\some($numerator / $denominator), }; @@ -40,7 +40,7 @@ $result = divide(2.0, 3.0); // Pattern match to retrieve the value if ($result->isSome()) { // The division was valid - echo "Result: {$option->unwrap()}"; + echo "Result: {$result->unwrap()}"; } else { // The division was invalid echo "Cannot divide by 0"; diff --git a/tools/apigen/theme/pages/index.latte b/tools/apigen/theme/pages/index.latte index d7c6887..1619f9f 100644 --- a/tools/apigen/theme/pages/index.latte +++ b/tools/apigen/theme/pages/index.latte @@ -41,9 +41,9 @@ * @param Option */ function divide(float $numerator, float $denominator): Option { - return match ($denomintor) { + return match ($denominator) { 0.0 => Option\none(), - _ => Option\some($numerator / $denominator) + default => Option\some($numerator / $denominator), }; } @@ -53,7 +53,7 @@ $result = divide(2.0, 3.0); // Pattern match to retrieve the value if ($result instanceof Option\Some) { // The division was valid - echo "Result: {$option->unwrap()}"); + echo "Result: {$result->unwrap()}"; } else { // The division was invalid echo "Cannot divide by 0";