Revision history for KeyPgEnd


Revision [24291]

Last edited on 2020-08-13 03:51:21 by fxm [splitted Return-from-gosub and Return-from-proc]
Additions:
- ##[[KeyPgReturn|Return (from procedure)]]##
- ##[[KeyPgReturnGosub|Return (from Gosub)]]##
Deletions:
- ##[[KeyPgReturn|Return]]##


Revision [20215]

Edited on 2016-02-10 15:59:35 by DkLwikki [Update link format]
Additions:
[[KeyPgDeclare|declare]] [[KeyPgSub|sub]] **End** ( [[KeyPgByval|byval]] //retval// [[KeyPgAs|as]] [[KeyPgLong|long]] = 0 )
print "ERROR: string was empty"
return 1
- ##[[KeyPgEndblock|End (Block)]]##
- ##[[KeyPgReturn|Return]]##
Deletions:
[[KeyPgDeclare declare]] [[KeyPgSub sub]] **End** ( [[KeyPgByval byval]] //retval// [[KeyPgAs as]] [[KeyPgLong long]] = 0 )
print "ERROR: string was empty"
return 1
- ##[[KeyPgEndblock End (Block)]]##
- ##[[KeyPgReturn Return]]##


Revision [17408]

Edited on 2015-01-03 14:55:20 by DkLwikki [Takes Long]
Additions:
[[KeyPgDeclare declare]] [[KeyPgSub sub]] **End** ( [[KeyPgByval byval]] //retval// [[KeyPgAs as]] [[KeyPgLong long]] = 0 )
Deletions:
[[KeyPgDeclare declare]] [[KeyPgSub sub]] **End** ( [[KeyPgByval byval]] //retval// [[KeyPgAs as]] [[KeyPgInteger integer]] = 0 )


Revision [17078]

Edited on 2014-05-06 11:07:07 by DkLwikki [Clarify: local vars won't be destroyed, but globals will be]
Additions:

Usage of this statement does not cleanly close scope. Local variables will not have their destructors called automatically, because ""FreeBASIC"" does not do stack unwinding. Only the destructors of global variables will be called in this case.
Deletions:
Usage of this statement does not cleanly close scope. Variables and memory are not destroyed automatically and object destructors are not called. Calling the required destructors and other clean-up should be explicitly performed before an ##**End**## statement.


Revision [16417]

Edited on 2012-11-03 04:01:45 by FxMwikki [Just wording: replace 'terminate' with 'exit' more appropriate for a not fully program completion.]
Additions:
Used to exit the program, and return to the operating system. An optional integer return value can be specified to indicate an error code to the system. If no return value is given, a value of ##0## is automatically returned at the end of the program.
Usage of this statement does not cleanly close scope. Variables and memory are not destroyed automatically and object destructors are not called. Calling the required destructors and other clean-up should be explicitly performed before an ##**End**## statement.
Deletions:
Used to exit the program, and return to the operating system. An optional integer return value can be specified to indicate an error code to the system. If no return value is given, a value of ##0## is automatically returned at the end of the program.
Usage of this statement does not cleanly close scope. Variables and memory are not destroyed automatically and object destructors are not called. Calling the required destructors and other clean-up should be explicitly performed before an ##**End**## statement.


Revision [16416]

Edited on 2012-11-03 03:59:22 by FxMwikki [Just one wording: replace 'terminate' with 'exit' which seems to be more appropriate for a not fully]
Additions:
Used to exit the program, and return to the operating system. An optional integer return value can be specified to indicate an error code to the system. If no return value is given, a value of ##0## is automatically returned at the end of the program.
Deletions:
Used to terminate the program, and return to the operating system. An optional integer return value can be specified to indicate an error code to the system. If no return value is given, a value of ##0## is automatically returned at the end of the program.


Revision [16415]

Edited on 2012-11-02 16:36:25 by CountingPine [Just one wording: replace 'terminate' with 'exit' which seems to be more appropriate for a not fully]
Additions:
For this reason, it is discouraged to use ##**End**## simply to mark the end of a program; the program will come to an end automatically, and in a cleaner fashion, when the last line of module-level code has executed.
Deletions:
For this reason, it is discouraged to use ##**End**## simply to mark the end of a program; the program will end automatically, and in a cleaner fashion, when the last line of module-level code has executed.


Revision [16414]

Edited on 2012-11-02 16:35:59 by CountingPine [Add warning; working/improved example]
Additions:
Used to terminate the program, and return to the operating system. An optional integer return value can be specified to indicate an error code to the system. If no return value is given, a value of ##0## is automatically returned at the end of the program.
For this reason, it is discouraged to use ##**End**## simply to mark the end of a program; the program will end automatically, and in a cleaner fashion, when the last line of module-level code has executed.
'' This program requests a string from the user, and returns an error
'' code to the OS if the string was empty
function main() as integer
'' assign input to text string
dim as string text
line input "Enter some text ( try ""abc"" ): " , text
'' If string is empty, print an error message and
'' return error code 1 (failure)
if( text = "" ) then
print "ERROR: string was empty"
return 1
end if
'' string is not empty, so print the string and
'' return error code 0 (success)
print "You entered: " & text
return 0
'' call main() and return the error code to the OS
end main()
- ##[[KeyPgReturn Return]]##
Deletions:
Used to terminate the program, and return to the operating system. An optional integer return value can be specified to indicate an error code to the system. If no return value is given, a value of 0 is automatically returned.
'' This program stores input from the user in a string, checks the strings length,
'' by calling valid_string, and either displays the string, or an error message
function valid_string( s as string ) as integer
return len( s )
'' assign input to text string (a string of spaces will input as an empty string)
dim as string text
print "Type in some text ( try ""abc"" ): " ;
input text
'' check if string is valid (not empty). If so, print an error message and return
'' to the OS with error code -1
if( not valid_string( text ) ) then
print "ERROR: you must enter a valid string"
sleep : end -1
end if
'' string is valid, so print the string and return to the OS with error code 0
print "You entered: " ; text
sleep : end 0


Revision [12090]

The oldest known version of this page was created on 2008-01-04 09:51:32 by ElSairon [Add warning; working/improved example]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode