Talk:Enumerations: Difference between revisions

(→‎Javascript/JSON: Syntax error?)
 
(5 intermediate revisions by 4 users not shown)
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)
:I think the word "types" is getting you. Maybe it should just be "an enumeration of fruits" since most of the examples seem to use apples, bananas, and cherries. --[[User:Mwn3d|Mwn3d]] 00:47, 15 March 2011 (UTC)
 
:Or maybe it should say ''"an enumeration of constants with and without '''explicit''' values"''. If you look at early revisions, you see that the task is inspired by typical enums of C-like languages. -- [[User:Wmeyer|Wmeyer]] 01:25, 15 March 2011 (UTC)
 
If you tell me that an apple is a type of fruit, then I understand the task. But saying "an enumeration of constants" might be better. --[[User:Kernigh|Kernigh]] 04:12, 15 March 2011 (UTC)
:Hi Kernigh. You might try looking at older versions of the page using the history tab. Gauge the total of what the current entries seem to be interpreting and then maybe coming up with a better wording? If it is your first edit to a task description then you could try it out here on the talk page and ask for comments - I find that helps me sometimes. :-)
: --[[User:Paddy3118|Paddy3118]] 06:04, 15 March 2011 (UTC)
 
: I changed the task according to my suggestion. I hope that's okay. -- [[User:Wmeyer|Wmeyer]] 00:43, 18 March 2011 (UTC)
Anonymous user