Setting variable with either value

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”.

On Oct 15, 2010, at 3:07 PM, Paul B. wrote:

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”.

If I understand you, this will do that:

@a = @b || “abc”

-Rob

Rob B.
[email protected] http://AgileConsultingLLC.com/
[email protected] http://GaslightSoftware.com/