Just started programming in BASIC trying to recall old knowledge and to help my self for university exams. So the first tries are on real simple coding.
One of the simple programs I made is a kind of quiz where you have to find out a random generated number between 1 to 100. So I set up a routine to help the player to understand how close he is to the hidden number. This routine is made with several ifs that check the absolute value of the difference between the hidden number and the input number by the player and give back a printed answer on how close you are.
Problem is I get the answers of only 2 of the ifs, even if the absolute value is correctly within range check of another of the ifs.
Routine is like:
100 If abs(x-a)>=40 then goto relevant print instruction else goto 110
110 if abs(x-a)<40 or abs(x-a)>20 goto relevant print instruction else goto 120
120 if abs(x-a)<19 or abs(x-a)>5 goto relevant print instruction else goto 130
130 if abs(x-a)<=5 goto relevant print instruction
where x is random generated number and a is input number by the player
Print instruction is like print something depending on the distance from the number and the goes back to input phase until the player wins and the program ends.
For some reason instructions 110 and 120 are not considerd.
Any hints?