syntax error for a case within a module

T

Thufir

For the project at <http://code.google.com/p/dwemthys/source>, I want to
use this module to instantiate a random Creature. Maybe a Dragon, maybe
a GreenDragon, maybe an IndustrialRaverMonkey or something else :)

I've done something similar in the past, but now I seem to have a syntax
error. Normally I would "return Dragon" or similar, but for now just
want to get the syntax squared away:

thufir@arrakis ~/Desktop/dwemthys $
thufir@arrakis ~/Desktop/dwemthys $
thufir@arrakis ~/Desktop/dwemthys $ ruby instantiate.rb
instantiate.rb:16: syntax error, unexpected $end, expecting kEND
thufir@arrakis ~/Desktop/dwemthys $
thufir@arrakis ~/Desktop/dwemthys $ cat instantiate.rb
require 'dragon'

module Instantiate

def makeCreature.randomCreature()

creatureType=Kernel.rand(0)

case creatureType
when 0
return 0
when 1
return 1
end #case
end #makeCreature

thufir@arrakis ~/Desktop/dwemthys $




thanks,

Thufir
 
T

Thufir

if you indented properly you'd SEE your problem.


Yup, thanks, I changed the name of the file but neglected to change the
name of the module.


Thanks,

Thufir
 

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

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top