Var
Var( name )
Var( name )
Var( name )
Var( name )
let name
Var ( name )
Parameters
Argument | Type | Definition and Requirements |
---|---|---|
|
The name of the variable whose value should be returned. |
Returns
The Value stored in the variable identified by name
.
Examples
The following query defines two variables in a Let
statement. The
first variable "x" contains the value 1 and the second variable "y"
contains the value 2. When the simple "in" expression is executed, it
returns the value stored in the variable "x".
try
{
Value result = await client.Query(
Let("x", 1, "y", 2).In(Var("x"))
);
Console.WriteLine(result);
}
catch (Exception e)
{
Console.WriteLine($"ERROR: {e.Message}");
}
LongV(1)
result, err := client.Query(
f.Let().Bind(
"x", 1).Bind(
"y", 2).In(
f.Var("x")))
if err != nil {
fmt.Fprintln(os.Stderr, err)
} else {
fmt.Println(result)
}
1
System.out.println(
client.query(
Let("x", Value(1), "y", Value(2)).in(Var("x"))
).get());
1
client.query(
q.Let({ x: 1, y: 2 }, q.Var('x'))
)
.then((ret) => console.log(ret))
.catch((err) => console.error('Error: %s', err))
1
result = client.query(
q.let({"x": 1, "y": 2}, q.var("x"))
)
print(result)
1
try {
println(Await.result(
client.query(
Let(Seq("x" -> 1, "y" -> 2), Var("x"))
),
5.seconds
))
} catch {
case unknown: Throwable => println("Error: " + unknown.getMessage())
}
1
Was this article helpful?
We're sorry to hear that.
Tell us how we can improve!
Visit Fauna's Discourse forums
or email docs@fauna.com
Thank you for your feedback!