Skip to content

Question on printing variables to the console #26

Answered by ArgosOfIthica
tmob03 asked this question in Q&A
Discussion options

You must be logged in to vote

Good catch, I don't mention this very well in the documentation.

There's 2 methods. There's the debug operator ?, which when used like:

a = ?a

Will print the value of a to the console, but in binary.

I've been too busy to write a standard library, where the 2nd alternative would have gone, but you can quite simply implement print yourself.

service print {
    jump (a) {{[echo 0]} {[echo 1]} {[echo 2]} .... }
}

While verbose, this is very fast, as jump determines which block to execute by scanning the bits of a; it can be as fast as a single comparison. Then, I'd generally recommend setting the value of a with whatever value you want to examine rather than creating this service for every …

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@tmob03
Comment options

@tmob03
Comment options

@tmob03
Comment options

@ArgosOfIthica
Comment options

Answer selected by tmob03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants