Add TextWriter, IOException, per-VM module data and pre-load imports; Add console module with Console class
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'console';
|
||||
class Luhn {
|
||||
private string $number;
|
||||
|
||||
@@ -33,9 +34,9 @@ class Program {
|
||||
while($i < $nums) {
|
||||
$luhn->setNumber($this->NUMBERS[$i]);
|
||||
if($luhn->validate()) {
|
||||
print('The number ' + $luhn->getNumber() + ' has passed the Luhn validation.' + "\n");
|
||||
Console::Print('The number ' + $luhn->getNumber() + ' has passed the Luhn validation.' + "\n");
|
||||
} else {
|
||||
print('The number ' + $luhn->getNumber() + ' has NOT passed the Luhn validation.' + "\n");
|
||||
Console::Print('The number ' + $luhn->getNumber() + ' has NOT passed the Luhn validation.' + "\n");
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user