Page loading

Share your opinion
What do you think about gambaslinux.fr?
 
Interesting
It miss some informations
Excellent website
Results
WIDGETS GAMBAS
GAMBAS 3 SOFTWARES
TUTORIALS
Library
RETURN - RETURN command
RETURN COMMAND


As the oriented objct language, gambas return value or not. It depends how to program your function.

A function who not return value could be for example :


PUBLIC SUB bonjour()
dim a AS INTEGER
a= 10
END

But if you want to return value ,use the command  RETURN.

Tips : you have to define the value type returned

for example :

PUBLIC SUB fonction1() AS String de type texte
PUBLIC SUB fonction1() AS FLOAT de type décimal
PUBLIC SUB fonction1() AS Integer de type entier
etc...

In the returned function, you have to create a variable in the same type than the function(here valretourne)
Well, you can code as this :

RETURN valretourne

In this example, when you click on a button, we go to the fonction1() , put the characters "ca a marché" in  valretourne and we put in the "toto" string and you display in a messagebox.

PUBLIC SUB fonction1() AS String
DIM valretournee AS String
valretournee = "ca a marché!"
RETURN valretournee
END


PUBLIC SUB Button1_Click()
toto = fonction1()
Message.Info(toto)
END



regards



Creation date : 08/10/2009 @ 08:39
Last update : 15/02/2022 @ 08:29
Category : RETURN
Page read 6119 times


Print the article Print the article


react.gifReactions to this article

Nobody gave a comment yet.
Be the first one to do it!


QUICK MENU
SEARCH




LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS

   visitors

   visitors online

ARCHIVES GAMBAS 1/2
^ Top ^