rl_lang/docs/entries/tutorial/t1/
p1.rs1use crate::docs::entry::{ConceptCategory, ConceptEntry, DescriptionEntry, DescriptionKind};
2pub static STEP_FIRST_PROGRAM: ConceptEntry = ConceptEntry {
3 name: "1. your first program",
4 summary: "your first program",
5 category: ConceptCategory::Tooling,
6 prerequisites: &[],
7 descriptions: &[
8 DescriptionEntry {
9 kind: DescriptionKind::Explanation,
10 title: None,
11 description: "programming is just giving a computer instructions, one line at a time. your first instruction: print something to the screen. println prints a value followed by a newline",
12 examples: &["println(\"hello, world\")"],
13 expected_output: &[],
14 },
15 DescriptionEntry {
16 kind: DescriptionKind::Explanation,
17 title: None,
18 description: "you can print numbers and expressions too, not just strings",
19 examples: &["println(42)\nprintln(1 + 1)"],
20 expected_output: &[],
21 },
22 DescriptionEntry {
23 kind: DescriptionKind::Explanation,
24 title: None,
25 description: "comments let you leave notes in your code. the computer ignores everything after //",
26 examples: &["// this prints a greeting\nprintln(\"hello\") // inline comment"],
27 expected_output: &[],
28 },
29 DescriptionEntry {
30 kind: DescriptionKind::Explanation,
31 title: None,
32 description: "print does the same as println but does not add a newline at the end, so the next output appears on the same line",
33 examples: &[
34 "get print from std::io\n\nprint(\"hello \")\nprint(\"world\")\n// output: hello world",
35 ],
36 expected_output: &[],
37 },
38 DescriptionEntry {
39 kind: DescriptionKind::Explanation,
40 title: None,
41 description: "exercise: print a welcome message for your guessing game. it should greet the player and tell them what the game is about\n\nexpected output:\n welcome to the guessing game!\n i am thinking of a number between 1 and 100\n can you guess it?",
42 examples: &[
43 "// your game starts here\nprintln(\"welcome to the guessing game!\")\nprintln(\"i am thinking of a number between 1 and 100\")\nprintln(\"can you guess it?\")",
44 ],
45 expected_output: &[],
46 },
47 ],
48 pitfalls: &[],
49 related: &[],
50 related_stdlib: &[],
51 since: None,
52};