Posted: 13th May 2021 14:02
i want to create a function that returns the number of the center of the screen:
+ Code Snippet
function GetScreenHeightCenter(screen_height)
	/* esta funcion esta hecha para sacar el centro del alto de la pantalla*/
	center = screen_height / 2
	 
	return center
endfunction


but the compiler says:
main.agc:21: error: Unexpected token "center", RETURN must be followed by a new line
Posted: 14th May 2021 18:08
sorry, i deleted your thread. i meant to delete the initial post and keep the edit.

i asked that it be re-instated and here we are:

i hope this answers your Q:
+ Code Snippet
do

    If GetRawKeyState(27) then Exit

    Print( ReturnCenter() )
    Sync()
loop

Function ReturnCenter()
	Result = GetVirtualWidth() /2 
EndFunction Result

see User Defined Functions 1/2-way down the help page.

also, note proper use of Return.
Posted: 14th May 2021 21:18
a function return in AppGameKit is ExitFunction, the return keyword is used to exit a GoSub