Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Print Statements #28424

Draft
wants to merge 4 commits into
base: mainnet
Choose a base branch
from
Draft

[Feature] Print Statements #28424

wants to merge 4 commits into from

Conversation

d0cd
Copy link
Collaborator

@d0cd d0cd commented Oct 25, 2024

This PR adds support for print statements in Leo via core function calls, e.g Leo::print.
This is done by implementing a print instruction in an experimental branch of snarkVM.
While the opcode works, the output can be hard to parse when used in the Leo CLI.

For example, for this program:

program printer.aleo {
    transition main(a: u32, b: u32) -> u32 {
        let result: u32 = a + b;
        Leo::print(result);
        return result;
    }
}

the output of leo execute main 1u32 2u32 looks like

> leo execute main 1u32 2u32
       Leo ✅ Compiled 'printer.aleo' into Aleo instructions
2550859538u32
3u32
3u32
3u32
.
.
.

This is because the program is executed and evaluated multiple times in a single call to leo execute.
UX improvements are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant