![]() |
Forum Index : Microcontroller and PC projects : Call Subroutine with Missing Parameter - Bug?
Author | Message | ||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1132 |
Strange behaviour on my CMM2 (v5.0702) The manual says "missing values will be assumed to be either zero or an empty string." > list option default integer i = 0 testsub testsub 1 testsub:testsub 2 testsub :testsub 3 print "Number of calls:" i end sub testsub n print "parameter =" n i = i + 1 end sub > run parameter = 0 parameter = 1 parameter = 2 parameter = 0 parameter = 3 Number of calls: 5 Note the missing result before the call with the parameter set to 2. If a colon appears immediately after the subroutine name, the subroutine doesn't appear to be called at all. Visit Vegipete's *Mite Library for cool programs. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
With the semicolon as the last character of the first 'word' on a line, the interpreter assumes you are creating a line label. Jim VK7JH MMedit |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1132 |
Makes sense, I suppose. Made for puzzling program behaviour until I figured out the 'work-a-round' of adding a space, or a new line. From the manual "A variable name or a label must not be the same as a function" but says nothing about a subroutine. Visit Vegipete's *Mite Library for cool programs. |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |