Gosub is not used in high level languages, you will use functions.
"Gosub" is a BASIC construct for calling subroutines. Arduino has subroutines (aka "functions") that work about the same, but are defined and called differently.
Here's some code from the Basic Stamp Reference Manual:
Main:
DEBUG CLS ' Clear DEBUG window
FOR phrase = 1 TO 6 ' Print blocks one by one
LOOKUP (phrase - 1),
[Text1, Text2, Text3, Text4, Text5, Text6], idx
GOSUB Print_It
PAUSE 5000 ' Pause for 5 seconds
NEXT
END
Print_It:
DO
READ idx, char ' Get next character
idx = idx + 1 ' Point to next location
IF (char = 0) THEN EXIT ' If 0, we're done with block
DEBUG char ' Otherwise, transmit it
LOOP
RETURN ' Return to the main routine
Similar code in C (for arduino) would look something like this:
void print_it(int idx)
{
char c;
do {
c = readdata[idx];
idx += 1;
if (c == 0) {
break;
}
debug(c);
} while (1);
}
main(void)
{
int phrase, idx;
debug(CLS);
for (phrase = 0; phrase < 6; phrase++) {
idx = lookup(phrase, textarray);
print_it(idx);
delay(5000);
}
}