rl_lang/docs/entries/concepts/logical_operators/
mod.rs1use crate::docs::entry::{ConceptCategory, ConceptEntry, DescriptionEntry, DescriptionKind};
2
3pub static LOGICAL_OPERATORS: ConceptEntry = ConceptEntry {
4 name: "logical operators",
5 descriptions: &[
6 DescriptionEntry {
7 description: "`and` evaluates to true only if both sides are true",
8 examples: &["true and true // true", "true and false // false"],
9 kind: DescriptionKind::Explanation,
10 title: None,
11 expected_output: &[],
12 },
13 DescriptionEntry {
14 description: "`or` evaluates to true if either side is true",
15 examples: &["false or true // true", "false or false // false"],
16 kind: DescriptionKind::Explanation,
17 title: None,
18 expected_output: &[],
19 },
20 DescriptionEntry {
21 description: "`and`/`or` combine naturally with comparisons inside conditions",
22 examples: &[
23 "dec int age = 20\ndec bool has_id = true\n\nif age >= 18 and has_id {\n println(\"allowed\")\n}",
24 ],
25 kind: DescriptionKind::Explanation,
26 title: None,
27 expected_output: &[],
28 },
29 DescriptionEntry {
30 description: "`!` (not) negates a bool and binds tighter than `and`/`or`",
31 examples: &["dec bool ok = !false and true // true"],
32 kind: DescriptionKind::Explanation,
33 title: None,
34 expected_output: &[],
35 },
36 ],
37 summary: "",
38 category: ConceptCategory::Syntax,
39 prerequisites: &["operators"],
40 pitfalls: &[],
41 related: &["operators"],
42 related_stdlib: &[],
43 since: None,
44};