If Statement in Interpreter?

I just began writing some basics for a script interpreter; however, I can not figure out how to make an if statement. Any ideas?
Err.... How about... check the condition and then jump to a different part of the script depending on whether or not the condition is true. =P

Vague question = vague answer.
Well, that is how an If statement should work, I was hoping for example code... I have it set to check the condition then assuming the condition is true, set bool isIf to true, then when it rolls through the code again it checks isIf, and if it is true, it checks if the line under the if is indented, if so, it works as an if should, if not it makes isIf false, so it doesn't check the line under that, the problem is that I don't know how to check if it is indented, using fstream.
So this is an indentation based scripting language... kinda like Python?

With fstream, you can just use getline() to get an entire line of text in a string:

1
2
3
4
string line;
getline( your_file, line );

// line now contains the entire line 


You can then look at the indentation by looping through each character in the string to count the whitespace.
Topic archived. No new replies allowed.