Print debugging statement: Difference between revisions

Content added Content deleted
m (→‎Insitux: formatting improvement)
m (→‎{{header|Wren}}: Minor tidy)
 
Line 1,172: Line 1,172:


What is generally done in practice is to hard-code some location indicator (such as the line number itself) at which a variable's value is being obtained. The Go example code then looks like this when translated to Wren.
What is generally done in practice is to hard-code some location indicator (such as the line number itself) at which a variable's value is being obtained. The Go example code then looks like this when translated to Wren.
<syntaxhighlight lang="ecmascript">import "/fmt" for Fmt
<syntaxhighlight lang="wren">import "./fmt" for Fmt


class Point {
class Point {
Line 1,236: Line 1,236:
{{libheader|Wren-debug}}
{{libheader|Wren-debug}}
We can also rewrite this code using the above module which, whilst still quite basic, provides a more structured approach to debugging than the first version.
We can also rewrite this code using the above module which, whilst still quite basic, provides a more structured approach to debugging than the first version.
<syntaxhighlight lang="ecmascript">import "./fmt" for Fmt
<syntaxhighlight lang="wren">import "./fmt" for Fmt
import "./debug" for Debug
import "./debug" for Debug