Setting variable with either value

P

Paul Bergstrom

Is there a better way to write this?

@a = "abc"

@a = @b if @b

This will set value @a to @b if @b already have a value since before. If
not it will use the default @a which is "abc".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,143
Messages
2,570,822
Members
47,368
Latest member
michaelsmithh

Latest Threads

Top