You may optionally enter a comparison operator (<, <=, >, >=, <> or =) at the beginning of each of your search values to specify how the comparison should be done.
S arr("dim1","dim2")="value"
Set arr("dim1",99)=187
; Persistent, will be saved with prefix ^:
S ^save("dim1","dim2")="saved value"
29
Java
Array
Array definieren
String[] ar = new String[] {"Satz1", "Satz2"};
38
PHP
Array
Über alle Array-Elemente interieren
$arr = array(1, 2, 3, 4);
foreach ($arr as &$value) {
$value = $value * 2;
}
// $arr is now array(2, 4, 6, 8)
foreach ($arr as $key => $value) {
echo "{$key} => {$value} ";
}
301
PL/pgSQL
Array
Über alle Array-Elemente interieren
DO
$do$
DECLARE
m text[];
arr text[] := '{{key1,val1},{key2,val2}}'; -- array literal
BEGIN
FOREACH m SLICE 1 IN ARRAY arr
LOOP
RAISE NOTICE 'another_func(%,%)', m[1], m[2];
END LOOP;
END
$do$;
-- ---------------------------------------------------------
DO
$do$
DECLARE
i text;
arr text[] := '{key1,key2}'; -- array literal
BEGIN
FOREACH i IN ARRAY arr
LOOP
RAISE NOTICE 'another_func(%)', i;
END LOOP;
END
$do$;
62
VB.NET
Array
Array definieren
Dim myStrArray(3) As String
myStrArray(0)="First"
myStrArray(1)="Second"
myStrArray(2)="Third"
myStrArray(3)="Fourth"
ReDim strJahreszeiten(4)
myStrArray(4)="Fifth"
Dim my2DimStrArray(1,2) As String
my2DimStrArray(0,0) = "This"
my2DimStrArray(0,1) = "is"
my2DimStrArray(0,2) = "a"
my2DimStrArray(1,0) = "2"
my2DimStrArray(1,1) = "dimensional"
my2DimStrArray(1,2) = "matrix"
85
C#
Array
Deklarieren eines Arrays in C#
// Array direkt befüllen
string[] stringArray = {"a", "b", "c"};
// Array mit fester Länge
string[] stringArray = new string[5];
193
Python
Array
Dictionary Basics
# empty dict
myDict = {}
# some static values
myDict ={
"key1" : {"item1":"value1"},
"key2" : {"itemX":"valueY"},
"keyX" : {"item99":"value98"}
}
# update a key programmatically
myDict.update({"key1" = {"item2":"new value"}})
# iterate
for (key, subdict) in myDict.items():
current_key = key
current_subdict = subdict
# get an specific item
subdict = myDict.get("key2")
print subdict.get("itemX")
# valueY
15
PHP
Variablen
Existenz der Varible abfragen
$status=isset($test);
if ($status) echo "Variable existiert: $test";
if (!isset($test2)) echo "Variable test2 existiert nicht!";
16
Mumps
Variablen
Existenz der Varible abfragen
Set status=$Data(test)
If status Write !,"Variable existiert: "_test
I '$D(test2) W !,"Variable existiert nicht!"