Author Topic: Override print?  (Read 166 times)

0 Members and 1 Guest are viewing this topic.

Arnold

  • Hero Member
  • *****
  • Posts: 837
Override print?
« on: June 25, 2019, 06:09:12 AM »
Hi Charles,

using a print statement without argument gives an error message (Linker found unidentified names). Using print "" or print chr(13,10) will solve the problem. I wonder if it's legitimate to use an overriding function?

Code: [Select]
'uses console

sub print
  'print ""
  print chr(13,10)
end sub 


'print
print "Hello"
print
print "Goodbye"

'waitkey

I am not sure if side effects are expected if I try to override print in this way?

Roland

jcfuller

  • Full Member
  • ***
  • Posts: 155
Re: Override print?
« Reply #1 on: June 25, 2019, 07:06:51 AM »
Roland,
  Why would you want to do that with a message box?
With console just use printl
Code: [Select]

use console
printl "Hello"
printl
printl "Goodbye"

waitkey

James

Arnold

  • Hero Member
  • *****
  • Posts: 837
Re: Override print?
« Reply #2 on: June 25, 2019, 09:48:10 AM »
Hi James,

this is true. Therefore in my example I commented out: uses console. Then printl will give an error in any case. But perhaps my question is only academic. Using print "" or print chr(13,10) will always work.

Roland

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 4128
    • Oxygen Basic
Re: Override print?
« Reply #3 on: June 25, 2019, 12:31:21 PM »
Hi Roland,

You can create any number of override functions providing they do not contain optional or default params.