Jump to content
Sign in to follow this  
GiulioM

I cannot insert variables in texts

Recommended Posts

GiulioM

I've problems with inserting variables in text, like so: MsgBox (1, "", You've winned "$sum" dollars.")

Why? if i control w/ Syntax check prod, it says only "syntax control".

I want to obtain, for example, a window that says me: "You've winned $ 40 betting $ 10 on the horse 'Speed'."

Share this post


Link to post
Share on other sites
Fulano

Missing the &:

MsgBox (1, "", You've winned " & $sum & " dollars.")
Posted Image

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Share this post


Link to post
Share on other sites
funkey

Opt("ExpandVarStrings", 1)
$sum = 20

; 3 different versions ;)
MsgBox (1, "", "You've winned " & $sum & " dollars.")
MsgBox (1, "", "You've winned $sum$ dollars.")
MsgBox (1, "", StringFormat("You've winned %s dollars.", $sum))


Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites
darkjohn20

MsgBox(1, "", "You've won " & $sum & " dollars.")

Fixed up a little.

Edited by darkjohn20

Share this post


Link to post
Share on other sites
Fulano

Congratulazioni! (Translation courtesy of google :()

Edited by Fulano

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.