DEF FN Not Working?

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

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
Posts: 9940
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.
Posts: 529
Joined: May 27, 2005 6:20
Location: Limoges, France

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 4 guests