Even though I get no errors and I'm able to print the file data, the input_1 does not seem to change to true in the whole loop. I therefore don't print 'y', just an endless series of x. I want the while loop to wait until the input_1 variable changes and I don't want to use promises.
var fs = require("fs");
var input_1 = false;
var input_2 = false;
fs.readFile('input.txt', function(err, data){
if (err) {return console.log(err);};
console.log(data.toString());
input_1 = true;
})
fs.readFile('input2.txt', function(err, data){
if (err) {return console.log(err);};
console.log(data.toString());
input_2 = true;
})
while(!input_1){
console.log('x')
}
console.log('y')