LB Booster
« DATE$() return type »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:23am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: DATE$() return type  (Read 245 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx DATE$() return type
« Thread started on: Jun 2nd, 2015, 2:13pm »

The Liberty BASIC DATE$() function is a little unusual in sometimes returning a string and sometimes returning a number, depending on the parameter supplied. Indeed that feature seems to confuse LB 4.04, for example it will accept the following code without error:

Code:
    count$ = date$("days") 

You would expect that to raise a 'Type mismatch' error (since it is attempting to assign a numeric value to a string variable) but it doesn't. However it leaves LB in a confused state because an error may be raised in a subsequent statement that accesses the count$ variable.

For maximum compatibility, LBB will accept both these forms without generating an error, and the resulting variable (whether numeric or string) is entirely valid:

Code:
    count = date$("days")  ' correct according to the LB help documents
    count$ = date$("days") ' equivalent to count$ = str$(date$("days")) 

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls