문제

I have a variable of type value that stores a map, but I can not access the values by providing the keys:

rascal>a
value: ("s":"s")

rascal>a["s"]
|stdin:///|(2,3,<1,2>,<1,5>): subscript not supported on value at |stdin:///|(2,3,<1,2>,<1,5>)
☞ Advice

How can I parse the value to map in order to be able to retrieve my value ?

도움이 되었습니까?

해결책

if (map[str,str] myMap := a) {
   // do stuff with myMap
}
else {
  throw "<a> is not a map?";
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top