Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

Commit

Permalink
add info about fmtstr
Browse files Browse the repository at this point in the history
  • Loading branch information
critesjosh committed Aug 15, 2023
1 parent c9d132e commit 1060224
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions docs/standard_library/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ keywords:
]
---

# Logging

The standard library provides a familiar `println` statement you can use. Despite being a limited
implementation of rust's `println!` macro, this construct can be useful for debugging.

Expand All @@ -40,3 +38,21 @@ fn main(age : Field, height : Field) {
}

```

You can print multiple different types in the same statement and string as well as a new "fmtstr" type. A `fmtstr` can be specified in the same way as a normal string it just should be prepended with an "f" character:

```rust
let fmt_str = f"i: {i}, j: {j}";
std::println(fmt_str);

let s = myStruct { y: x, x: y };
std::println(s);

std::println(f"i: {i}, s: {s}");

std::println(x);
std::println([x, y]);

let foo = fooStruct { my_struct: s, foo: 15 };
std::println(f"s: {s}, foo: {foo}");
```

0 comments on commit 1060224

Please sign in to comment.