A Scripting Language for Web, Linux and Windows

A Scripting Language for Web, Linux and Windows

Datatypes in V1

V1 support following datatypes: Numbers, Strings, Boolean, Handles, Arrays

Number

Numbers are internally stored as floating point double values. That means also integer numbers are internally double values. Its important to know that, because of a big 64 Bit integer cannot be stored completely into a double value.

Types of number formats:

<?v1
10// Integer number
10.12// Floating point number
10e-9// Exponent number
0x8000// Hexadecimal number
0b0001// Binary number
0666// Octal number
?>

Big numbers:

<?v1
0xFFFFFFFFFFFFFFFF// Assign a 64 Bit hexadecimal number
print (a); 
/* 
The real value is 18446744073709551615.
But the internal floating point representation is 1.844674407371e+019 
It differs from the 13th position. 
*/
?>

String

Strings are internally representated as a buffer of bytes. A string can contain every character from 0 to 255, but usually UTF8 formatted text. V1 functions work with UTF8 charset. You can use the utf8_encode() and utf8_decode() functions to reformat from or to Latin2 charset. A String can be longer than the ending zero byte. The length of a string in bytes can be determined with strlen() function.

String formats:

<?v1

'String with single quotes. \'Internal single quotes must be escaped\' "Internal double quotes", 
All other escaped characters like \r\n have no effect.'
;

"String with double quotes. 'Internal single quotes', \"Internal double quotes must be escaped\", 
For escaped characters like \\ \r\n \t \x32 \77 see description below."
;

?>

Escaped characters in double quoted strings:

  • \r = Carriage return
  • \n = Line feed
  • \t = Tabulator
  • \\ = Backslash
  • \" = Double quote
  • \0 = Zero byte
  • \xHEX = Hexadecimal representated byte
  • \OOO = Octal representated byte (only decimal range 0..255)

Dynamic conversion between Strings and Numbers:

V1 detect if a string represents a number. Numbers can be used also in string functions.

<?v1
"10.23"+"12.23";
print (
gettype (c)); // Will output number
null 10.23;
print (
gettype (c)); // Will output number
10.23 ""
print (
gettype (c)); // Will output number
10e10;
print (
strlen (c)); // Will output 12
?>

Boolean

V1 support Boolean datatype with true and false, usually used for arguments.

Handle

Handles are references to internal objects and data structures such as Sockets or Files, generated from V1 functions.

Array

V1 support multi dimensional Arrays. There are two ways to define an array.

<?v1
// Array as a list. Every entry has a unique index beginning from 0.
= [ true1.333"String", ["Internal Array"172.3] ];

print (
a[1]); // will output 1.333
print_r (a[count(a)-1]); // will dump the internal array ("Internal Array", 172.3);

// Array as a dictionary with key/value pairs
= array ("Key1"=>"Value1""Key2"=>"Value2""Key3"=>1.333"Key4"=>array ("Key5"=>"Internal Array"));

print (
a["Key2"]); // will output Value2
?>

null

null is the identifier for an empty and undefined variable.

See also Datatype functions.

back to Home

V1 Version 0.96 - Documentation generated Sun, 05 May 2024 07:59