NOTE: This invite-only release of SunSed Alpha is for testing purposes and in no way represents the final quality of the product — join the waitlist (~wait time: 2 weeks). SunSed release date is on March 11, 2022.

Data Types

SunSed variables can hold the following data types;

  • Scalar Types
    • String
    • Integer
    • Float (floating point numbers)
    • Boolean
  • Compound Type
    • Array
  • Special Type
    • NULL

String

A string is any sequences of characters, it can hold letters, numbers and special characters. You may enclose the string using either double quotes or single quotes.

$full_name = "Micheal Scotch" 
$occupation = 'Regional General Manager'

Integers

These are whole numbers (without any decimal points - see float for decimal numbers) between -2,147,483,648 and 2,147,483,647

$age = 21
$years_driving = 3
$negative_number = -2

Float

Floats also known as "doubles", or "real numbers" are decimal numbers.

$purchase_amount = 999.99
$customer_rating = 4.53

Boolean

A boolean may be either: TRUE or FALSE

$bought_a_house = FALSE
$looking_for_a_house = TRUE

Array

In SunSed, arrays are indexed collection of key values, allowing you to hold more than one value at a time in a single variable. One of the most versatile and fundamental data types. You can add, modify, and delete (learn more at Array Library) values from an array after its creation. Array keys are unique, meaning you cannot have duplicate keys in an array.

There are two types of arrays; indexed and associative.

Indexed Array

Indexed arrays have integer keys beginning at 0 for every value, set by the position of the value in the array, that gets automatically assigned when adding values into the indexed array.

$top_brands = ['bmw', 'toyota']

# will result to
// [0 => 'bmw', 1 => 'toyota']

# accessing toyota by its key
PRINT $top_brands[1]
#=> toyota

Associative Array

On the other hand, associate arrays have strings for their indexes which may be used to access the value.

$car_sales_by_brand = ['bmw' => 32118, 'toyota' => 89012]

# accessing toyota's sales
PRINT $car_sales_by_brand['toyota']
#=> 89012

NULL

Null is a special value that may only hold the value of NULL and represents a variable that has no value assigned to it.

$a = NULL
Copyright © SunSed LLC 2013-2021 All rights reserved.