From 5744277e1dd9cd69ff7ee29d226231a6d54675da Mon Sep 17 00:00:00 2001 From: puffer Date: Thu, 19 Oct 2023 09:05:42 +0000 Subject: [PATCH] Added variables --- src/css/main.css | 10 +++++++++- src/getting-started.html | 2 ++ src/index.html | 2 +- src/variables.html | 37 ++++++++++++++++++++++++++++++++++++- 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/css/main.css b/src/css/main.css index a4a7342..06f6265 100644 --- a/src/css/main.css +++ b/src/css/main.css @@ -73,7 +73,8 @@ code { .multiCode p { margin: 0; align-self: flex-start; - color: #D63384 + color: #D63384; + font-family: monospace; } code { @@ -93,6 +94,7 @@ code { code p { margin: 0; align-self: flex-start; + font-family: monospace; } samp { @@ -108,3 +110,9 @@ samp { flex-direction: column; margin: 0; } + +.highlight { + color: rgb(61, 61, 61); + font-size: 12px; + +} \ No newline at end of file diff --git a/src/getting-started.html b/src/getting-started.html index 2f4a18b..5f3a852 100644 --- a/src/getting-started.html +++ b/src/getting-started.html @@ -27,6 +27,8 @@
  • Running pint for the first time
  • Your very first P program!
  • +
  • Variables
  • +
  • Function
  • diff --git a/src/index.html b/src/index.html index 22e9e38..7423d9b 100644 --- a/src/index.html +++ b/src/index.html @@ -40,7 +40,7 @@
  • Your very first P program!
  • Variables
  • -
  • Function/a>
  • +
  • Function
  • diff --git a/src/variables.html b/src/variables.html index dfc25da..cbcea77 100644 --- a/src/variables.html +++ b/src/variables.html @@ -20,7 +20,7 @@ alt="P Icon" />

    Variables

    +

    Simple introduction to understanding how variables work and how you define them and how you use them

    +

    Defining Variables

    +

    You can define a variable like this:

    + *mut type name = value +

    (* = optional)

    +

    type can be any of these: string, int, float, bool but also custom types (more on them here)
    name can be any letters, numbers but not any "-" or " " in them
    mut is used to say if the variable is modifiable, basically saying if you can change the value or not. To make a variable editable you do: mut type name = value if not its just type name = value

    +

    An example of defining a variable called name with the value "Kevin":string name = "Kevin"

    +
    +

    Using Variables

    +

    To use a variable you can simple just call its name, example: +

    +use writeln from @std.io
    +
    +string name = "Kevin"
    +writeln(name)
    +
    + Output: + Kevin +

    +

    To define a editable variable you can do:

    +use writeln from @std.io
     
    +mut age = 18
    +writeln("I am %{age}")
    +++age
    +writeln("I am %{age}")
    +        
    +
    + Output: + I am 18 +I am 19 +

    + \ No newline at end of file