title: netLOGO nested if how to set value of outer if in inner if
body: <p>how to set the value of 1st turtle when comparing 2 turtles value in nested if  like we have attribute age in turtles now if age of turtle 1 is greater then 20 then check age of turtle 2 in side the nested if of first if if the inner if condition true then set the value of age of turtle 1  here is the code example </p>
  
  <pre><code>let i 0
    let j 0
  
    let node1 one-of turtles
    let node2 one-of turtles
    ;; initialize the distance lists
    while [i &lt; number-of-nodes]
    [
      set j 0
      while [j &lt; number-of-nodes]
      [
        set node1 turtle i
        set node2 turtle j
        ;; zero from a node to itself
        if i != j 
        [
          ask node1
          [
            if value = 0 
             [
  
             ask node2
               [ 
                 if value = 0  [
                  ; here what i do so i can set the value of node1 
  
                       ]
  
            ]
           ]
  
  
        ]
        set j j + 1
      ]
      set i i + 1
    ]
  </code></pre>