I did use the '=' sign in my definition of a leap year, without the IF statement. For those just turning to PureBasic, that IS confusing.Thorium wrote:...because they are not supported outsite of if statements. So you should not use them in formulas at all.
PureBasic 4.50 is out !
Re: PureBasic 4.50 is out !
PureBasic 5.41 LTS | Xubuntu 16.04 (x32) | Windows 7 (x64)
Re: PureBasic 4.50 is out !
May it does work, but it is not supported AFAIK. What you're doing with the procedurereturn is just an alternative way to write this:With PureBasic working with boolean expressions is still very confusing. For example, this works:Code: Select all
Procedure.i LeapYear(Year.i) ;returns: ; - True (1) If the given year is a leapyear ; - False (0) if the given year is not a leapyear ProcedureReturn ((Year % 4) = 0) And ((Year % 100) <> 0) Or ((Year % 400) = 0) EndProcedure Debug LeapYear(2008) Debug LeapYear(2009)
Original line:
Code: Select all
ProcedureReturn ((Year % 4) = 0) And ((Year % 100) <> 0) Or ((Year % 400) = 0)
Code: Select all
x = ((Year % 4) = 0) And ((Year % 100) <> 0) Or ((Year % 400) = 0)
ProcedureReturn x
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Re: PureBasic 4.50 is out !
@ bleuznl, I was starting to wonder if I did the right thing with the LeapYear procedure while going through this topic. Normally I test things thoroughly, and if they work, I assume the compiler supports it. Obviously, that assumption is not correct. Thanks for pointing this out to me.
PureBasic 5.41 LTS | Xubuntu 16.04 (x32) | Windows 7 (x64)