Browsing through the help files I came across a command 'Clear'. However, it isn't actually documented anywhere in the help file. The usage was with structures, but I was wondering if this can be used to clear any variable?
I keep getting a compiler warning that I've not initialised a Char array. I was wondering if I could use Clear RxBuf rather than a for...next loop?
What does 'Clear' do?
Moderators: David Barker, Jerry Messina
-
- Posts: 219
- Joined: Wed Sep 11, 2013 1:27 pm
- Location: Chesterfield
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: What does 'Clear' do?
'Clear' sets the variable to zero, and works with pretty much anything... variables, structures, arrays, etc.
For an array (or structure) it zeros each element and should be faster and use less code than using a for/next loop.
When used with a string it works a bit differently. For them it just sets the first char to 0, which gives you a null string.
For an array (or structure) it zeros each element and should be faster and use less code than using a for/next loop.
When used with a string it works a bit differently. For them it just sets the first char to 0, which gives you a null string.
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: What does 'Clear' do?
Forgot to mention...
Clear is documented in the language reference pdf http://www.sfcompiler.co.uk/downloads/SFManual.pdf
There's probably some other nuggets in there that aren't in the help file (and vice-versa)
Clear is documented in the language reference pdf http://www.sfcompiler.co.uk/downloads/SFManual.pdf
There's probably some other nuggets in there that aren't in the help file (and vice-versa)