Skip to content

Instantly share code, notes, and snippets.

@ndugger
Last active October 15, 2019 05:00
Show Gist options
  • Save ndugger/f27d0a95d21585d74cee5ca076bcb1de to your computer and use it in GitHub Desktop.
Save ndugger/f27d0a95d21585d74cee5ca076bcb1de to your computer and use it in GitHub Desktop.
fn render(condition: bool) -> wjet::Tree {
let bar = false;
wml! {
<Block> {
let foo = false;
let name = "World";
if (!condition) {
<Block { foo: condition, baz: 7 }>
} else if (foo) {
<Block { foo: true }>
} else {
println!("Hello {}", name);
}
<Block { baz: 72 }>
}
<Block {}> {
// This will render the content 10 times
for x in (0..10) {
<Block { foo: x > 5, baz: 3 }> {
<Block { foo: condition }>
}
<Block { foo: false }>
}
}
<Block { baz: 69 }> {
match (bar) {
true => {
<Block { foo: true }>
},
false => {
<Block { foo: false }> {
<Block { foo: true }>
<Block { foo: false }>
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment