what is this sampel code mean

First of all, I am a newbie and apologize if this was asked in forum.

when I look at some sample code(Fruit Ninja) from Corona. one piece of code is written like this.
function shootObject(type)

local object = type == “fruit” and getRandomFruit() or getBomb()

end
What does this mean? Could someone help explaining this please?

Pixio [import]uid: 63983 topic_id: 25540 reply_id: 325540[/import]

It is equivalent to
[lua]local object
if type == “fruit” then
object = getRandomFruit()
else
object = getBomb()
end[/lua] [import]uid: 64174 topic_id: 25540 reply_id: 103222[/import]

Thanks for the prompt reply!!!
now, what should I write for this case?

[lua]local object
if type == “fruit” then
object = getRandomFruit()
elseif type == “misc”
object = getRandomMisc()
else
object = getBomb()
end[/lua] [import]uid: 63983 topic_id: 25540 reply_id: 103225[/import]

It would not look too good when you use this method for more than 2 conditions IMO.

Still you can write it as
[lua]local object = (type == “fruit”) and getRandomFruit() or
((type == “misc”) and getRandomMisc() or getBomb())[/lua]
You should just stick to the if statements [import]uid: 64174 topic_id: 25540 reply_id: 103227[/import]

ah ha, thanks a lot!
[import]uid: 63983 topic_id: 25540 reply_id: 103230[/import]