简体   繁体   English

WSO2 Jaggery-如何将数字解析为整数

[英]WSO2 Jaggery - how to parse a number into an integer

In this simple jaggery code 在这个简单的代码中

for(var i=0;i<10;i++){

print(i);

}

Output was like 输出就像

0.0

1.0

.... ....

I need to parse these outputs into integer. 我需要将这些输出解析为整数。 I tried parseInt(i) method but it also gave the same result. 我尝试了parseInt(i)方法,但它也给出了相同的结果。 What could be the reason for that? 可能是什么原因呢?

I'm no Jaggery expert, but i have tried your code Try It tool which can be found in Jaggery Website and it gave me expected result. 我不是Jaggery专家,但是我已经尝试过您的代码Try It工具,可以在Jaggery网站上找到它,它给了我预期的结果。

The sample code i have tried is, 我尝试过的示例代码是

<html> 
  <body> 
    <h1> 
      <% 
        for(var i=0;i<10;i++){
          print(i "\n");
        } 
      %> 
    </h1> 
  </body> 
</html>

Which gave me output, 这给了我输出

0123456789

HTH, HTH,

DarRay DarRay

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM