Initialize variables

Post Reply
User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Initialize variables

Post by rbytes »

It would speed coding if SPL would initialize undefined numeric variables to 0 and string variables to "" on first use, the way you handled them in SB, rather than terminating the program with an error.
The only thing that gets me down is gravity...

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Initialize variables

Post by Mr. Kibernetik »

This blocks incorrect objects from usage.
For example, if you have an object "aaa" and then misspell it as "aab" so you will get an error instead of silent usage using 0 value.
Also, SPL does not know if it is a text or a numeric object to initialize it to 0 or "".

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: Initialize variables

Post by rbytes »

I can see the value of that. Maybe it would have been better to suggest introduction of error trapping so the program can be made recoverable.
The only thing that gets me down is gravity...

Post Reply