RosettaCodeData/Task/Topic-variable/FreeBASIC/topic-variable.basic
2023-07-01 13:44:08 -04:00

20 lines
500 B
Text

' FB 1.05.0 Win64
' Three different ways of returning a value from a function
Function Sum (x As Integer, y As Integer) As Integer
Sum = x + y '' using name of function
End Function
Function Sum2 (x As Integer, y As Integer) As Integer
Function = x + y '' using Function keyword
End Function
Function Sum3 (x As Integer, y As Integer) As Integer
Return x + y '' using Return keyword which always returns immediately
End Function
Print Sum (1, 2)
Print Sum2(2, 3)
Print Sum3(3, 4)
Sleep