Search code examples
basic

QuickBASIC variable only used on one line.


I have been asked to convert a QuickBASIC program into c. I do not know BASIC at all. There is a line within a while loop that looks something like:

var_a = var_b * (1.5 * var_c - .5 * var_d) : var_d = var_c

var_d appears no where else in the code, what is going on here? Is var_d going to be initialized at 0 then basically stay one loop behind var_c?


Solution

  • The colon operator just separates statements. reference This line of code is equivalent to:

    var_a = var_b * (1.5 * var_c - .5 * var_d)
    var_d = var_c
    

    If var_d isn't referenced then it's just a useless statement.