Skip to content

Commit

Permalink
Create printf_example.go
Browse files Browse the repository at this point in the history
  • Loading branch information
crStiv authored Dec 27, 2024
1 parent 845a230 commit c8a6104
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions examples/printf_example.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package examples

import "github.com/consensys/gnark/frontend"

func PrintfExample(api frontend.API) {
x := api.Add(10, 20)
y := api.Mul(x, 2)

// Basic usage
api.Printf("x = %v, y = %v\n", x, y)

// Different formats for constants and variables
api.Printf("dec: %d hex: %x\n", x, x)

// Debugging information
api.Printf("coeff: %c var: %i\n", x, y)
}

0 comments on commit c8a6104

Please sign in to comment.