Refactored equals, added documentation

This commit is contained in:
Netkas 2022-12-29 14:17:56 -05:00
parent 172bc4866a
commit 0cbb927066
2 changed files with 36 additions and 2 deletions

35
docs/equals.md Normal file
View file

@ -0,0 +1,35 @@
# equals
Returns true if the two values are equal, false otherwise.
## Parameters
* a (`integer`, `float`, `double`, `string`, `boolean`, `instruction`) - The first value to compare.
* b (`integer`, `float`, `double`, `string`, `boolean`, `instruction`) - The second value to compare.
## Return
(`boolean`) - True if the two values are equal, false otherwise.
## Exceptions
* `EvaluationException` - If there was an error while evaluating one or more parameters.
* `TypeException` - If one or more parameters are not of the expected type.
## Instruction Example
```json
{
"type": "equals",
"_": {
"a": "foo",
"b": "foo"
}
}
```
### Last Updated
Monday, December 29th, 2022.
Written by [Netkas](https://git.n64.cc/netkas)

View file

@ -66,14 +66,13 @@
* @param Engine $engine * @param Engine $engine
* @return bool * @return bool
* @throws EvaluationException * @throws EvaluationException
* @throws EvaluationException
*/ */
public function eval(Engine $engine): bool public function eval(Engine $engine): bool
{ {
$a = $engine->eval($this->A); $a = $engine->eval($this->A);
$b = $engine->eval($this->B); $b = $engine->eval($this->B);
return $a === $b; return ($a === $b);
} }
/** /**