Initalising multi-dimentional arrays with muiltiple values

New to FreeBASIC? Post your questions here.
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Initalising multi-dimentional arrays with muiltiple values

Post by dodicat »

The var is a bit like auto in c++
var x=0.0, x is double
var y=6, y is integer
var s="Hello",s is string.
The #define is a macro, I could have made map a function, but the macro behaves like a function (with care), inlined, and it is more compact.
Because I have used the division (/) inside #map() the result of map is a double.
Any parameters sent to #map should be bracketed if they are not simple
map((2+3),(6+9),x,0,5)
Or I could have put all the brackets inside the macro, which is really the proper way.
IvanisIvan
Posts: 44
Joined: Nov 07, 2019 21:57

Re: Initalising multi-dimentional arrays with muiltiple values

Post by IvanisIvan »

dodicat wrote:The var is a bit like auto in c++
var x=0.0, x is double
var y=6, y is integer
var s="Hello",s is string.
The #define is a macro, I could have made map a function, but the macro behaves like a function (with care), inlined, and it is more compact.
Because I have used the division (/) inside #map() the result of map is a double.
Any parameters sent to #map should be bracketed if they are not simple
map((2+3),(6+9),x,0,5)
Or I could have put all the brackets inside the macro, which is really the proper way.
I see, How peculiar and efficient! Thank you for the deep explanation, I hope to benefit from this greatly.
fxm
Moderator
Posts: 12082
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Initalising multi-dimentional arrays with muiltiple values

Post by fxm »

You can also help yourself with the documentation:
FreeBASIC Manual
for example:
Post Reply