Call a function: Difference between revisions

Call a function en True BASIC
(Call a function en QBasic)
(Call a function en True BASIC)
Line 5,427:
However, there are no deep differences between the two: functions are translated into commands that are called in a particular namespace (thus <tt>foo()</tt> becomes <tt>tcl::mathfunc::foo</tt>).
There are no differences in usage between built-in commands and user-defined ones, and parameters are passed to commands by value conceptually (and read-only reference in the implementation).
 
 
=={{header|True BASIC}}==
{{trans|FreeBASIC}}
<lang qbasic>FUNCTION Copialo$ (txt$, siNo, final$)
FOR cont = 1 TO ROUND(siNo)
LET nuevaCadena$ = nuevaCadena$ & txt$
NEXT cont
 
LET Copialo$ = LTRIM$(RTRIM$(nuevaCadena$)) & final$
END FUNCTION
 
SUB Saludo
PRINT "Hola mundo!"
END SUB
 
SUB testCadenas (txt$)
FOR cont = 1 TO ROUND(LEN(txt$))
PRINT (txt$)[cont:cont+1-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\'")
END</lang>
{{out}}
<pre>
Igual que la entrada de FreeBASIC.
</pre>
 
 
=={{header|UNIX Shell}}==
2,123

edits