DEF FN Not Working?

Windows specific questions.
toml_12953
Posts: 27
Joined: Jul 07, 2005 12:37
Location: Malone, NY
Contact:

DEF FN Not Working?

Postby toml_12953 » Aug 30, 2019 22:49

Is DEF FN not working in lang qb? Quick BASIC allows the user to define functions but FreeBASIC gives me an error when I try to compile a program with a DEF FN line.

Code: Select all

10 def fna(x)=4*x


error 10: Expected '=', found 'fna'
10 def fna(x)=4*x
fxm
Posts: 9178
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: DEF FN Not Working?

Postby fxm » Aug 31, 2019 5:06

FreeBASIC does not support DEF FN routines.
See the paragraph "Differences from QB" at STATIC page.
jdebord
Posts: 520
Joined: May 27, 2005 6:20
Location: Limoges, France
Contact:

Re: DEF FN Not Working?

Postby jdebord » Aug 31, 2019 8:35

You can use a macro instead :

Code: Select all

#define fna(x) (4 * (x))


but don't forget the parentheses :)

Return to “Windows”

Who is online

Users browsing this forum: No registered users and 24 guests