You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should add support for arrays! They would allow us to create complex structures.
Changes:
Restructure for loops to iterate over an array:
for<variableName>of<array>{}
to would create an array:
varnums: int[]=1to10foriofnums{}
Function array(length: number): any[]:
letlist: string[]=array(5)
To make that possible we would also have to implement nulls (#171)
Function count(list: any[]): int
letlength: int=count(list)
New syntax [0, 1] to create initialized arrays (automatically detect types):
letlist2=[1,2,3,4,5]// I know, you could use 1 to 5 here
New syntax list[i]:
letvalue=list2[2]// = 3
That would allow us to create such functions:
functionprompt(questions: string[]): string[]{letresult: string[]=array(count(questions))varindex=0;forqofquestions{print(q)result[index]=input()index++// I think we already have that}returnresult}
The text was updated successfully, but these errors were encountered:
We should add support for arrays! They would allow us to create complex structures.
Changes:
Restructure
for
loops to iterate over an array:to
would create an array:Function
array(length: number): any[]
:To make that possible we would also have to implement
null
s (#171)Function
count(list: any[]): int
New syntax
[0, 1]
to create initialized arrays (automatically detect types):New syntax
list[i]
:That would allow us to create such functions:
The text was updated successfully, but these errors were encountered: