# Nested statements

Page 1 of 1

## 4 Replies - 3584 Views - Last Post: 08 April 2006 - 06:33 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=14405&amp;s=c40132038fc4e5586d414e096bcbcb9c&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 snoj

• Married Life

Reputation: 64
• Posts: 3,505
• Joined: 31-March 03

# Nested statements

Posted 27 January 2006 - 12:17 AM

Does anyone here know of any articles that explain/teach the concept on how to navigate nested statements?

example:
```if(something) {
while(var == true) {
if(i < 10000) {
i++;
} else {
var = false;
}
}
}
if(a1_steak_sauce == GOOD) {
print("let's eat the steak!");
}
```

I'm thinking recursion would be required of this. But anyway basically I'd like to learn how to be able to navigate and manipulate such a statement "tree".

Thanks all!

Is This A Good Question/Topic? 0

## Replies To: Nested statements

### #2 born2c0de

• printf("I'm a %XR",195936478);

Reputation: 175
• Posts: 4,667
• Joined: 26-November 04

## Re: Nested statements

Posted 27 January 2006 - 03:24 AM

It's not recursion.
Recursion is a function calling itself (direct) or a function f1 calling f2 that calls f1 (indirect).

Try this.
Single step into your loop while keeping the loop variables in the Watch List.
That's a fun way to see how nested stuff works.

### #3 snoj

• Married Life

Reputation: 64
• Posts: 3,505
• Joined: 31-March 03

## Re: Nested statements

Posted 27 January 2006 - 09:07 AM

Maybe you misunderstand? I want to parse a nested statement structure. GEt the "data" out of it, and then rebuild it in, oh say, the php syntax.

### #4 William_Wilson

• lost in compilation

Reputation: 199
• Posts: 4,807
• Joined: 23-December 05

## Re: Nested statements

Posted 08 April 2006 - 12:49 AM

The easiest way i've ever found to get/see the data from loops and nested loops is to generate the assembly code and then use a good debgger to watch all the stack values/registers. In this way you can see EVERY change each line of code makes (broken down into the simplest of code - without using binary)

This post has been edited by William_Wilson: 08 April 2006 - 12:50 AM

### #5 snoj

• Married Life

Reputation: 64
• Posts: 3,505
• Joined: 31-March 03

## Re: Nested statements

Posted 08 April 2006 - 06:33 AM

Yeah....but that doesn't do much to offer insight into making a function/method/whatever to parse nested statements.