Call a function: Difference between revisions
Content added Content deleted
(Call a function en QBasic) |
|||
Line 4,193: | Line 4,193: | ||
## For partial function application see: |
## For partial function application see: |
||
## http://rosettacode.org/wiki/Partial_function_application#Python</lang> |
## http://rosettacode.org/wiki/Partial_function_application#Python</lang> |
||
=={{header|QBasic}}== |
|||
{{works with|QBasic|1.1}} |
|||
{{works with|QuickBasic|4.5}} |
|||
{{trans|FreeBASIC}} |
|||
<lang qbasic>FUNCTION Copialo$ (txt$, siNo, final$) |
|||
DIM nuevaCadena$ |
|||
FOR cont = 1 TO siNo |
|||
nuevaCadena$ = nuevaCadena$ + txt$ |
|||
NEXT cont |
|||
Copialo$ = LTRIM$(RTRIM$(nuevaCadena$)) + final$ |
|||
END FUNCTION |
|||
SUB Saludo |
|||
PRINT "Hola mundo!" |
|||
END SUB |
|||
SUB testCadenas (txt$) |
|||
FOR cont = 1 TO LEN(txt$) |
|||
PRINT MID$(txt$, cont, 1); ""; |
|||
NEXT cont |
|||
END SUB |
|||
SUB testNumeros (a, b, c) |
|||
PRINT a, b, c |
|||
END SUB |
|||
CALL Saludo |
|||
PRINT Copialo$("Saludos ", 6, "") |
|||
PRINT Copialo$("Saludos ", 3, "!!") |
|||
PRINT |
|||
CALL testNumeros(1, 2, 3) |
|||
CALL testNumeros(1, 2, 0) |
|||
PRINT |
|||
CALL testCadenas("1, 2, 3, 4, cadena, 6, 7, 8, \'incluye texto\'")</lang> |
|||
{{out}} |
|||
<pre> |
|||
Igual que la entrada de FreeBASIC. |
|||
</pre> |
|||