Sum numbers from 1 to 10
ASPL 0.7.0 · Current release
A complete program with three supplied source variants for browser and native hosts.
On this page
What the program does
This complete program adds the integers from 1 through 10. It uses mutable integer bindings, a while loop, and an if statement. The source stays unchanged when you switch reading language.
Arabic source
This supplied variant uses Arabic keywords. Open it as a separate Home draft; it will not replace another draft or run automatically.
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.
متغير العدد: ص64 = 1.
طالما (العدد <= 10) {
المجموع = المجموع + العدد.
العدد = العدد + 1.
}
إذا (المجموع يطابق 55) {
اطبع("55\س").
أرجع 0.
}
أرجع 1.
}
Expected outcomes
{
"browser": {
"check": "success",
"class": "success",
"output": "55\n",
"processStatus": 0
},
"native": {
"check": 0,
"status": 0,
"output": "55\n"
}
}English source
This supplied variant uses English keywords. It belongs to the same sum example family as the Arabic and mixed variants.
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 start_main() -> i64 {
var total: i64 = 0;
var number: i64 = 1;
while (number <= 10) {
total = total + number;
number = number + 1;
}
if (total matches 55) {
print("55\n");
return 0;
}
return 1;
}
Expected outcomes
{
"browser": {
"check": "success",
"class": "success",
"output": "55\n",
"processStatus": 0
},
"native": {
"check": 0,
"status": 0,
"output": "55\n"
}
}Mixed source
This supplied variant uses both vocabularies. It is its own source file, not a translation generated by the website.
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 ابدأ_الرئيسية() -> ص64 {
متغير المجموع: ص64 = 0;
متغير العدد: ص64 = 1;
طالما (العدد <= 10) {
المجموع = المجموع + العدد;
العدد = العدد + 1;
}
إذا (المجموع matches 55) {
print("55\n");
return 0;
}
أرجع 1;
}
Expected outcomes
{
"browser": {
"check": "success",
"class": "success",
"output": "55\n",
"processStatus": 0
},
"native": {
"check": 0,
"status": 0,
"output": "55\n"
}
}Check the outcome
The catalog records the checked result for the browser and native hosts. Predict the output and returned status before expanding it.
Show the expected browser and native outcomes for the English source.
{
"browser": {
"check": "success",
"class": "success",
"output": "55\n",
"processStatus": 0
},
"native": {
"check": 0,
"status": 0,
"output": "55\n"
}
}