Compiling PHP's conditional statements to Rust It's time to take another step into compilation land and look at compiling PHP's conditional statements (if statements) into Rust code. The goal for this post will be compiling the following code: $guess = readline("Guess a number between 1 and 3: "); $number = rand(1, 3); if ($guess == $number) { echo "You guessed the number correctly, well done!"; } else { echo "The correct answer is ".
An assignment expression in the Rust code will be represented with a let statement.
For now it compiles the initial if statement and checks to see if there is a valid else statement at the end.