Typed list values
ASPL 0.7.0 · Current release
Complete supplied source, preparation, and checked ASPL 0.7.0 outcomes.
On this page
Purpose and preparation
Browser and native, ASPL 0.7.0. Passes a typed list to a function, checks exact numeric elements, and prints 12 with status 0.
See the current reference. No source module or external library is required.
Arabic source
This supplied complete source opens a new draft. Prepare the declared inputs/files in that draft, then select Run explicitly.
Execution: Browser and native · ASPL 0.7.0
- No prior knowledge is required to open and check it.
Input: No input lines are required.
دالة المجموع(القيم: قائمة<ص64>) -> ص64 {
أرجع القيم[0] + القيم[1] + القيم[2].
}
دالة ابدأ_الرئيسية() -> ص64 {
دع القيم: قائمة<ص64> = [3, 4, 5].
إذا (طول(القيم) لا يطابق 3) { أرجع 1. }
إذا (المجموع(القيم) لا يطابق 12) { أرجع 2. }
دع بايتات: قائمة<ط8> = [0, 255].
إذا (طول(بايتات) لا يطابق 2 أو بايتات[0] لا يطابق 0 أو بايتات[1] لا يطابق 255) { أرجع 3. }
دع كسور: قائمة<ع64> = [0.5].
إذا (كسور[0] لا يطابق 0.5) { أرجع 4. }
اطبع("12").
أرجع 0.
}
Expected outcomes
{
"browser": {
"check": "success",
"class": "success",
"output": "12",
"processStatus": 0
},
"native": {
"check": 0,
"status": 0,
"output": "12"
}
}English source
This supplied complete source opens a new draft. Prepare the declared inputs/files in that draft, then select Run explicitly.
Execution: Browser and native · ASPL 0.7.0
- No prior knowledge is required to open and check it.
Input: No input lines are required.
fn total(values: list<i64>) -> i64 {
return values[0] + values[1] + values[2];
}
fn start_main() -> i64 {
let values: list<i64> = [3, 4, 5];
if (length(values) not match 3) { return 1; }
if (total(values) not match 12) { return 2; }
let bytes: list<u8> = [0, 255];
if (length(bytes) not match 2 or bytes[0] not match 0 or bytes[1] not match 255) { return 3; }
let fractions: list<f64> = [0.5];
if (fractions[0] not match 0.5) { return 4; }
print("12");
return 0;
}
Expected outcomes
{
"browser": {
"check": "success",
"class": "success",
"output": "12",
"processStatus": 0
},
"native": {
"check": 0,
"status": 0,
"output": "12"
}
}Mixed source
This supplied complete source opens a new draft. Prepare the declared inputs/files in that draft, then select Run explicitly.
Execution: Browser and native · ASPL 0.7.0
- No prior knowledge is required to open and check it.
Input: No input lines are required.
fn total(القيم: list<ص64>) -> i64 {
return القيم[0] + القيم[1] + القيم[2];
}
fn ابدأ_الرئيسية() -> ص64 {
دع xs: قائمة<i64> = [3, 4, 5].
if (طول(xs) not match 3) { return 1; }
إذا (total(xs) not match 12) { أرجع 2. }
let bytes: قائمة<u8> = [0, 255];
إذا (length(bytes) not match 2 أو bytes[0] not match 0 أو bytes[1] not match 255) { return 3. }
let fractions: list<ع64> = [0.5];
if (fractions[0] not match 0.5) { أرجع 4. }
print("12");
return 0;
}
Expected outcomes
{
"browser": {
"check": "success",
"class": "success",
"output": "12",
"processStatus": 0
},
"native": {
"check": 0,
"status": 0,
"output": "12"
}
}Check the result
The source cards show the catalog's exact inputs and outcomes. Locale changes do not translate the supplied source. Download retains original source bytes.