From c8a6104ebf00435fb8bce76c3767d1dce880b23a Mon Sep 17 00:00:00 2001 From: crStiv Date: Fri, 27 Dec 2024 03:09:56 +0100 Subject: [PATCH] Create printf_example.go --- examples/printf_example.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 examples/printf_example.go diff --git a/examples/printf_example.go b/examples/printf_example.go new file mode 100644 index 000000000..fd19fc6ff --- /dev/null +++ b/examples/printf_example.go @@ -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) +}