title: Prolog: How to check if variable is initialized before use?
body: <p>I have a code that looks like this:</p>
  
  <pre><code>path(Node1, Node2, Distance):- edge(Node1, Node2, Dist),
      Distance is Dist + Distance, !.
  </code></pre>
  
  <p>This rule will be called recursively; however, whenever I try to call it an error occurs stating that Distance isn't sufficiently initialized. Why is this happening? I assume the solution would be to check if Distance is initialized in the first place. Is there a way to do this?</p>