Variable Declarations

In SunSed, you can declare a variable using the following syntax:

$variable_name = value;

You can name the variable whatever you like, but it must start with a $ symbol. The value assigned to the variable can be of any type, including integers, floats, strings, arrays, and more.

If you don't want to assign a value to the variable at declaration, you can do so using the following syntax:

$variable_name;

The above will create an empty variable with no value.

Additionally, SunSed has some built-in data types for variables, including:

Here's an example of variable declarations in SunSed:

# integer variable $num = 10 # float variable $pi = 3.14 # string variable $name = "John" # boolean variable $is_true = true # array variable $my_array = [1, 2, 3] # variable can change value too $name = "Jane"

Variable Names

Variable names in SunSed can contain letters, numbers, and underscores, and must start with a letter or underscore. They cannot contain spaces or special characters like !, @, #, $, %, etc.

Here are some examples of valid variable names:

  • $my_var
  • $myVar
  • $myVar123
  • $_myVar
  • $myvar123
  • And here are some examples of invalid variable names:

  • $my var (contains a space)
  • $my!var (contains a special character)
  • $1var (starts with a number)
  • It's important to choose descriptive variable names that are easy to understand and remember. Good variable names can make your code more readable and easier to maintain in the long run.