mirror of
https://github.com/Open-Argon/docs.git
synced 2026-10-28 09:43:55 +00:00
update
This commit is contained in:
1 parent
bd58748eaa
commit
5c12756d58
2 files changed
+5
-1
No files matched your search
@@ -1,2 +1,4 @@
|
||||
# docs
|
||||
read the [spec](spec)
|
||||
|
||||
- [Variable and function assignment](variable-and-function-assignment)
|
||||
+3
-1
@@ -9,7 +9,7 @@ To define a variable using the `let` keyword, you need to specify the variable n
|
||||
let x = 10
|
||||
```
|
||||
|
||||
In this example, we define a variable named `x` and initialise it with a value of `10`. The `let` keyword tells the Argon interpreter to define the variable on the current stack.
|
||||
In this example, we define a variable named `x` and initialise it with a value of `10`. The `let` keyword tells the Argon interpreter to define the variable on the current stack. If `x` already exists in the current stack, then it will throw a `Name Error` of `Name Error: variable "x" already exists`.
|
||||
|
||||
Method 2: Assigning a value to a variable name
|
||||
|
||||
@@ -49,6 +49,8 @@ In this example, we define a variable `x` with a value of `10` using `let`. We t
|
||||
|
||||
# Function Assignment
|
||||
|
||||
`let` works exactly the same way as it does in variable assignment.
|
||||
|
||||
```javascript
|
||||
let square(x) = do
|
||||
return x * x
|
||||
Reference in new issue
Block a user