javascript - Coffescript switch when -


my coffeescript following:

level = switch       when 0 <= value <= 1 0       when 1 < value <= 2 1       when 2 < value <= 3 2       when 3 < value <= 4 3       when 4 < value <= 5 4       else 6 

why :

uncaught error: execjs::programerror: [stdin]:15:4: error: unexpected when when 1 < value <= 2 1

this works fine:

 when value <= cool 0       when value >= warm 4       else          bucketsize = (warm - cool) / 3 # total # of colours in middle         math.ceil (value - cool) / bucketsize 

this works:

 level = switch       when value <= 1 0       when value <= 4 4       else 5 

untill add when value <=2 1

it indentation.

level = switch       when 0 <= value < 1 0       when 1 <= value < 2 1       when 2 <= value < 3 2       when 3 <= value < 4 3       when 4 <= value <= 5 4       else 5 

i kept code here : http://www.coffeelint.org/

and checked indentation.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -