diff options
author | Andras Timar <atimar@suse.com> | 2012-11-15 11:10:24 +0100 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2012-11-15 20:46:51 +0100 |
commit | ff39701b0e841035089929ab7811c7431ab9b39b (patch) | |
tree | 03f3607f3ad5c5b788f8932a80c6c847bd90b1ae /source/text/sbasic/shared/03050100.xhp | |
parent | 6291844ea9c4c1d6863c62cbd33e841ff21d3e7a (diff) |
format Basic code examples
Diffstat (limited to 'source/text/sbasic/shared/03050100.xhp')
-rw-r--r-- | source/text/sbasic/shared/03050100.xhp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/source/text/sbasic/shared/03050100.xhp b/source/text/sbasic/shared/03050100.xhp index 657da7ef59..8c090fa59c 100644 --- a/source/text/sbasic/shared/03050100.xhp +++ b/source/text/sbasic/shared/03050100.xhp @@ -48,24 +48,28 @@ dedr: fixed #i30425#</lastedited> <paragraph role="paragraph" id="par_id3153394" xml-lang="en-US" l10n="U" oldref="2">Returns the line number where an error occurred during program execution.</paragraph> </section> <paragraph role="heading" id="hd_id3147574" xml-lang="en-US" level="2" l10n="U" oldref="3">Syntax:</paragraph> -<paragraph role="paragraph" id="par_id3146795" xml-lang="en-US" l10n="U" oldref="4">Erl</paragraph> +<bascode>
+<paragraph role="bascode" id="par_id3146795" xml-lang="en-US" oldref="4">Erl</paragraph>
+</bascode> <paragraph role="heading" id="hd_id3147265" xml-lang="en-US" level="2" l10n="U" oldref="5">Return value:</paragraph> <paragraph role="paragraph" id="par_id3154924" xml-lang="en-US" l10n="U" oldref="6">Integer</paragraph> <paragraph role="heading" id="hd_id3150792" xml-lang="en-US" level="2" l10n="U" oldref="7">Parameters:</paragraph> <paragraph role="note" id="par_id3153771" xml-lang="en-US" l10n="U" oldref="8">The Erl function only returns a line number, and not a line label.</paragraph> <paragraph role="heading" id="hd_id3146921" xml-lang="en-US" level="2" l10n="U" oldref="9">Example:</paragraph> -<paragraph role="paragraph" id="par_id3146975" xml-lang="en-US" l10n="U" oldref="10">sub ExampleError</paragraph> -<paragraph role="paragraph" id="par_id3150010" xml-lang="en-US" l10n="U" oldref="11">on error goto ErrorHandler REM Set up error handler</paragraph> -<paragraph role="paragraph" id="par_id3155308" xml-lang="en-US" l10n="U" oldref="12">Dim iVar as Integer</paragraph> -<paragraph role="paragraph" id="par_id3149482" xml-lang="en-US" l10n="U" oldref="13">Dim sVar As String</paragraph> -<paragraph role="paragraph" id="par_id3153188" xml-lang="en-US" l10n="U" oldref="14">REM Error caused by non-existent file</paragraph> -<paragraph role="paragraph" id="par_id3159155" xml-lang="en-US" l10n="U" oldref="15">iVar = Freefile</paragraph> -<paragraph role="paragraph" id="par_id3146120" xml-lang="en-US" l10n="U" oldref="16">Open "\file9879.txt" for Input as #iVar</paragraph> -<paragraph role="paragraph" id="par_id3147349" xml-lang="en-US" l10n="U" oldref="17">Line Input #iVar, sVar</paragraph> -<paragraph role="paragraph" id="par_id3151073" xml-lang="en-US" l10n="U" oldref="18">Close #iVar</paragraph> -<paragraph role="paragraph" id="par_id3148456" xml-lang="en-US" l10n="U" oldref="19">exit sub</paragraph> -<paragraph role="paragraph" id="par_id3147394" xml-lang="en-US" l10n="U" oldref="20">ErrorHandler:</paragraph> -<paragraph role="paragraph" id="par_id3155416" xml-lang="en-US" l10n="U" oldref="21">MsgBox "Error " & err & ": " & error$ + chr(13) + "In line : " + Erl + chr(13) + Now , 16 ,"An error occurred"</paragraph> -<paragraph role="paragraph" id="par_id3153878" xml-lang="en-US" l10n="U" oldref="22">end sub</paragraph> +<bascode> +<paragraph role="bascode" localize="false" xml-lang="en-US">Sub ExampleError</paragraph> +<paragraph role="bascode" id="par_id3150010" xml-lang="en-US" l10n="U" oldref="11">On Error GoTo ErrorHandler ' Set up error handler</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US">Dim iVar As Integer</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US">Dim sVar As String</paragraph> +<paragraph role="bascode" id="par_id3153188" xml-lang="en-US" l10n="U" oldref="14">' Error caused by non-existent file</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> iVar = Freefile</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> Open "\file9879.txt" For Input As #iVar</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> Line Input #iVar, sVar</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> Close #iVar</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> Exit Sub</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US">ErrorHandler:</paragraph> +<paragraph role="bascode" id="par_id3155416" xml-lang="en-US" l10n="U" oldref="21"> MsgBox "Error " & err & ": " & Error$ + chr(13) + "In Line : " + Erl + chr(13) + Now , 16 ,"An error occurred"</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph> +</bascode> </body> </helpdocument> |