Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
computers:arduino:breeze [03-Jun-2019 14:04] – [Calling Subroutines] Steve Joynt | computers:arduino:breeze [02-Feb-2025 16:14] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 167: | Line 167: | ||
The word " | The word " | ||
- | On line 200 there is a coding error. The command " | + | On line 200 there is a coding |
==== Named Sections of Code ==== | ==== Named Sections of Code ==== | ||
Line 174: | Line 174: | ||
I propose to use the hash character "#" | I propose to use the hash character "#" | ||
- | The first parameter will be the name of the label, and must be unique within the script. More parameters may be supplied, but will be ignored as comments, but beware of using [brackets] or (brackets) within the parameters as they will be executed as usual. It is recommended to enclose any comments in quotes. | + | The first parameter will be the name of the label, and must be unique within the script. |
+ | |||
+ | More parameters may be supplied, but will be ignored as comments, but beware of using [brackets] or (brackets) within the parameters as they will be executed as usual. It is recommended to enclose any comments in quotes. | ||
+ | |||
+ | If the first parameter is "#", | ||
< | < | ||
Line 186: | Line 190: | ||
< | < | ||
- | 100 # CountDown "This is the entry point to this sub-routine" | + | 100 # CountDown "This is the entry point to this section of code" |
+ | 105 # # "It counts down from 10 to 1, then signals 'Blast Off'" | ||
110 set count 10 | 110 set count 10 | ||
200 # CountDownLoop | 200 # CountDownLoop | ||
Line 205: | Line 210: | ||
BASIC has the keywords " | BASIC has the keywords " | ||
- | It is not possible to pass parameters to subroutines in BASIC using the " | + | It is not possible to pass parameters to subroutines in BASIC using the " |
< | < | ||
- | 100 set ask.question "Which country do you come from?" | + | 100 set AskUser.question "Which country do you come from?" |
110 gosub AskUser | 110 gosub AskUser | ||
- | 120 set ask.question "Why have you come here from "[ get ask.answer ]"?" | + | 120 set AskUser.question "Why have you come here from "[ get AskUser.answer ]"?" |
130 gosub AskUser | 130 gosub AskUser | ||
- | 140 set ask.question "Are you a spy?" | + | 140 set AskUser.question "Are you a spy?" |
150 gosub AskUser | 150 gosub AskUser | ||
160 display "I don't believe you!" | 160 display "I don't believe you!" | ||
170 end | 170 end | ||
200 # AskUser "Keep asking a question until we get an answer" | 200 # AskUser "Keep asking a question until we get an answer" | ||
- | 210 display [ get ask.question ] | + | 210 display [ get AskUser.question ] |
- | 220 input ask.answer | + | 220 input AskUser.answer |
- | 230 if ( [ get ask.answer ] == "" | + | 230 if ( [ get AskUser.answer ] == "" |
240 return | 240 return | ||
</ | </ |