mirror of
https://github.com/Open-Argon/argon-v3.git
synced 2025-12-06 00:46:07 +00:00
add byte object
This commit is contained in:
@@ -79,6 +79,12 @@ func makeGlobal() ArObject {
|
|||||||
}
|
}
|
||||||
return ArBuffer([]byte{}), ArErr{}
|
return ArBuffer([]byte{}), ArErr{}
|
||||||
}}
|
}}
|
||||||
|
vars["byte"] = builtinFunc{"byte", func(a ...any) (any, ArErr) {
|
||||||
|
if len(a) != 0 {
|
||||||
|
return nil, ArErr{TYPE: "TypeError", message: "expected 0 arguments, got " + fmt.Sprint(len(a)), EXISTS: true}
|
||||||
|
}
|
||||||
|
return ArByte(0), ArErr{}
|
||||||
|
}}
|
||||||
vars["throwError"] = builtinFunc{"throwError", ArThrowError}
|
vars["throwError"] = builtinFunc{"throwError", ArThrowError}
|
||||||
vars["array"] = builtinFunc{"array", func(a ...any) (any, ArErr) {
|
vars["array"] = builtinFunc{"array", func(a ...any) (any, ArErr) {
|
||||||
if len(a) == 0 {
|
if len(a) == 0 {
|
||||||
|
|||||||
20
tests/chatbot code.ar
Normal file
20
tests/chatbot code.ar
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# This is a comment
|
||||||
|
|
||||||
|
term.log("Hello World!") # Printing to console/output
|
||||||
|
|
||||||
|
value = "Hello" # Declaring a variable
|
||||||
|
|
||||||
|
do # Start of indented block
|
||||||
|
combined = value + " World!"
|
||||||
|
term.log(combined)
|
||||||
|
|
||||||
|
loop = true # Using true condition
|
||||||
|
|
||||||
|
while (loop) do # While loop syntax
|
||||||
|
term.log("Looping...")
|
||||||
|
loop = false # Using false condition
|
||||||
|
|
||||||
|
if (value == "Hello") do # If statement syntax
|
||||||
|
term.log("The value is Hello")
|
||||||
|
else do # else block
|
||||||
|
term.log("The value is not Hello")
|
||||||
2
tests/rng.ar
Normal file
2
tests/rng.ar
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
forever do
|
||||||
|
term.log(random())
|
||||||
Reference in New Issue
Block a user