Re: Macros for literal strings
Posted: Wed Oct 07, 2009 12:22 pm
it is NOT easier to read, it is NOT BASIC, it is NOT the default settings.
so what?
so what?
http://www.purebasic.com
https://www.purebasic.fr/english/
But , as Trond put it in his original suggestion,Kaeru Gaman wrote:it is NOT easier to read, it is NOT BASIC, it is NOT the default settings.
so what?
Code: Select all
Macro Int(Value) :_DQ_+Str(Value)+_DQ_
EndMacro
Macro Float(Value) :_DQ_+StrF(Value)+_DQ_
EndMacro
Macro String(Value) :_DQ_+Value+_DQ_
EndMacro
Macro _DQ_:"
EndMacro
Long.l = 128
Debug "Long = Int(Long) :-)"
Pi.f = #PI
Value$ = "PI is Float(Pi), nice?"
Debug Value$
Debug "Any String is: String(Value$) ."
It seems to my like an attempt to get string interpolation like you have in Perl or PHP:PB wrote:When run, the above code would output this:Code: Select all
; Pseudo-code. StringMacro PB PureBasic EndStringMacro MessageRequester("","This PB example was coded in PB")
Code: Select all
# Perl Code
$variable="PureBasic"
print "I love $variable!"