Extract expected result.

This commit is contained in:
Stephen Chung 2021-09-27 11:13:48 +08:00
parent e963a7251c
commit 0d651f74ce
2 changed files with 6 additions and 4 deletions

View File

@ -84,6 +84,7 @@ Below is the standard _Fibonacci_ example for scripting languages:
const TARGET = 28;
const REPEAT = 5;
const ANSWER = 317_811;
fn fib(n) {
if n < 2 {
@ -107,8 +108,8 @@ print(`Finished. Run time = ${now.elapsed} seconds.`);
print(`Fibonacci number #${TARGET} = ${result}`);
if result != 317_811 {
print("The answer is WRONG! Should be 317,811!");
if result != ANSWER {
print(`The answer is WRONG! Should be ${ANSWER}!`);
}
```

View File

@ -3,6 +3,7 @@
const TARGET = 28;
const REPEAT = 5;
const ANSWER = 317_811;
fn fib(n) {
if n < 2 {
@ -26,6 +27,6 @@ print(`Finished. Run time = ${now.elapsed} seconds.`);
print(`Fibonacci number #${TARGET} = ${result}`);
if result != 317_811 {
print("The answer is WRONG! Should be 317,811!");
if result != ANSWER {
print(`The answer is WRONG! Should be ${ANSWER}!`);
}