Gambas3 => Domande tecniche => Topic aperto da: vuott - 07 Dicembre 2013, 00:01:09
Titolo: Carattere di continuazione di riga nel codice
Inserito da: vuott - 07 Dicembre 2013, 00:01:09
Vi riporto questa discussione apparsa nella M.L. ufficiale:
" Is there a line continuation character available for code? I find that I often have very long lines (e.g. in Exec commands).
John Rose "
" There is no line continuation character, but you usually can go to another line inside an expression after a comma.
Regards,
-- Benoît Minisini "
" I agree with John, Benoît. There really should be a specific character to continue a line; if only to keep from confusing anyone maintaining the code. Put it on the 'nice to have' list, anyway.
Bill "
" If you are using SHELL, you can assign lines to variables. If the string continues on multiple lines, assign the text to string variables, and concatenate those variables. The example below merely shows SHELL accepting a string variable as its command string:
DIM sRes as String DIM shellString as String
shellString = "cat /proc/meminfo" Shell shellString To sRes
If you use EXEC, the flexibility is more limited, as the command cannot be contained in a variable, but the following will work:
DIM execString as String DIM sRes as String execString = "/proc/meminfo" Exec ["cat", execString] To sRes
MinnesotaJon "
Titolo: Re: Carattere di continuazione di riga nel codice
Inserito da: Top Fuel - 08 Dicembre 2013, 17:54:57
Beh, le linee sono talmente lunghe che voglio vedere come fai a riempirle... :D
Titolo: Re: Carattere di continuazione di riga nel codice
Inserito da: vuott - 08 Dicembre 2013, 23:45:10