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
the sample code:
10 diameter=5
20 gosub 100
30 print area
40 diameter=12
50 gosub 100
60 print area
70 end
100 print "The area of a circle of diameter "; diameter; " is: ";
110 area = pi*(diameter/2)^2
120 return
run
The area of a circle of diameter 5 is
19.6349540849
The area of a circle of diameter 12 is
113.0973355292
Mismatched statement closing mark at line 70
Adds an error when no error should be the expected
In this other example (forget about the logic )
Nothing to return to at line 160
Ready
shows up
The reason being is because end is used as an 'ending marker' for if statements. This feature is somewhat unique to atto since most other BASICs only support one-liner ifs, which seemed counter-intuitive if being able to make multiline for loops was possible.
The reason why atto throws the Mismatched statement closing mark error is because it expects there to be a preceeding if to match the end, akin to accidentally having an extra } at the end of a JavaScript/C-like program.
It may be seen as quite confusing for old BASIC users who would usually use end to stop a program, however I couldn't really see an alternative keyword that's used for ending if statements (Lua uses end like atto; fi is used in bash but is a bit obscure). As a consequence, stop is used instead of end.
It does appear that gosub seems to be in working order, though, which is good.
Based on the comments on Issue devicefuture#15devicefuture#15 I proposed the changes for the gosub example. On the other hand, a typo on the repeat example foes not allow to run it
the sample code:
10 diameter=5
20 gosub 100
30 print area
40 diameter=12
50 gosub 100
60 print area
70 end
100 print "The area of a circle of diameter "; diameter; " is: ";
110 area = pi*(diameter/2)^2
120 return
run
The area of a circle of diameter 5 is
19.6349540849
The area of a circle of diameter 12 is
113.0973355292
Mismatched statement closing mark at line 70
Adds an error when no error should be the expected
In this other example (forget about the logic )
Nothing to return to at line 160
Ready
shows up
10 cls
20 number_marks = 0
30 while number_marks < 100
40 if number_marks mod 2 = 1
50 ratius=10
60 gosub 140
70 else
80 ratius=5
90 gosub 140
100 break
110 number_marks = number_marks + 1
120 loop
130 end
140 move 250, 200
150 draw ratius, ratius + number_marks
160 return
The text was updated successfully, but these errors were encountered: