Asked — Edited

Is There A Step By Step Guide For Using Variables And Arrays In This Scripting L

Just curios if there is a step by step guide on using variables and arrays in this scripting language?


ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.

#1  

Not to my knowledge. TUTORIAL TIME! ;)

To set a variable, you use:


$myvariable = "chicken"

A variable must be assigned something before you call it in the script.

To make an If statement using a variable, you need to compare the variable to either a set value or a sensor value.


If ($myvariable = "chicken")
Say("Chicken!")
Else
Say("Its not Chicken")
Endif

Every script command has an explanation about it in the script manual.

#2  

OK thanks for the help seems pretty simple. I will also see what other script related tutorials I can find just on general scripting.

PRO
Synthiam
#3  

All programming languages use the concept of variables, and they're identical. Any information you find on any programming language will apply the basis to ez-script, or visual basic, or c#, or c++, etc..

As technopro pointed out, you can assign strings and numbers. Those are primitive elements of computers.

Number A number is not a character found in words. A number includes one of the following digits only: 0 1 2 3 4 5 6 7 8 9 . *Note i included the period (.) because it is an attribute to a number.

When assigning a number to a variable, you do it like this...


$variableName = 5

Strings (words) Strings are words, such as you are reading or will find in the dictionary. A string is words wrapped in quotes. A quote is this character ". The reason strings require quotes, is to tell the computer where the string begins, and where the string ends. This differs from a number, because a number does not have spaces.

Here is an example of assigning a string to a variable


$variableName = "Hello World"

Use the EXAMPLES folder included in ARC to view examples of programming concepts. There is directions on finding the Examples folder in the activities tutorial: https://synthiam.com/Tutorials/Course/6

Also, follow the activities tutorials and variables and IF conditions and and and are all included.

PRO
Synthiam
#5  

No prob!:)

Here's an example you can play with as well

  1. Load ARC

  2. Add an EZ-Script control (Add Control -> Scripting -> EZ-Script)

  3. Press Config and paste this code



$Variable = "Hello World"

print($Variable)

run that

also, you can do this



$Variable = "Hello";

print( $Variable + " World" )

or this



$Variable1 = "Hello"

$Variable2 = "World"

print( $Variable1 + " " + $Variable2 )

#7  

Great I will get to work with the new info.:)

United Kingdom
#9  

Lol, thanks Dave.:)

(Link fixed).