Checking to see if a variable is set


#1

Hey guys, i have a pretty quick question. I need to make an IF statement
that does #action if a certain param (params[:theme]) is set.

How would i go about coding that with ruby? As an example I’ll include
the PHP equivilent of what i need to do…

[CODE]<?php
if (isset($_GET[‘id’])){

Do some code here, id had a value.

}else{

Do some code here, id did NOT have a value.

}
?>[/CODE]

OR

[CODE]<?php
if (empty($_GET[‘id’])){

Do some code here, id did NOT have a value.

}else{

Do some code here, id had a value.

}
?>[/CODE]

Thanks,

  • Jeremy

#2

if @params[:id]

do some code

else

do something else

end

Kent.