Talk:Enumerations: Difference between revisions

(→‎Javascript/JSON: Syntax error?)
Line 10:
 
I'm getting a syntax error for "<tt>{ apple, banana, cherry }</tt>", both Javascript and JSON variants. Is there some flavor that supports this syntax? --[[User:MizardX|MizardX]] 12:39, 27 May 2010 (UTC)
 
== Bad task description? ==
 
The task description says: ''"Create an enumeration of types with and without values."'' But none of the solutions seem to do that. Some of the solutions seem to create an enumeration of integers.
 
If I wanted to create an enumeration of types, I would do something like: <lang ruby># Ruby
[String, Integer, Float, File, Thread].each { |type| puts type }
 
{String: "a sequence of bytes or characters",
Integer: "a number like 33",
Float: "a number like 33.0",
File: "an open file",
Thread: "a concurrent task"}.each { |type, value| puts type, value }</lang>
 
--[[User:Kernigh|Kernigh]] 00:44, 15 March 2011 (UTC)
Anonymous user