Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Call-a-function/ZX-Spectrum-Basic/call-a-function.basic
Normal file
12
Task/Call-a-function/ZX-Spectrum-Basic/call-a-function.basic
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
10 REM functions cannot be called in statement context
|
||||
20 PRINT FN a(5): REM The function is used in first class context. Arguments are not named
|
||||
30 PRINT FN b(): REM Here we call a function that has no arguments
|
||||
40 REM subroutines cannot be passed parameters, however variables are global
|
||||
50 LET n=1: REM This variable will be visible to the called subroutine
|
||||
60 GO SUB 1000: REM subroutines are called by line number and do not have names
|
||||
70 REM subroutines do not return a value, but we can see any variables it defined
|
||||
80 REM subroutines cannot be used in first class context
|
||||
90 REM builtin functions are used in first class context, and do not need the FN keyword prefix
|
||||
100 PRINT SIN(50): REM here we pass a parameter to a builtin function
|
||||
110 PRINT RND(): REM here we use a builtin function without parameters
|
||||
120 RANDOMIZE: REM statements are not functions and cannot be used in first class context.
|
||||
Loading…
Add table
Add a link
Reference in a new issue