You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Dmitri Blinov (Jira)" <ji...@apache.org> on 2022/06/12 14:23:00 UTC

[jira] [Comment Edited] (JEXL-372) Add support for 'standard' for loop

    [ https://issues.apache.org/jira/browse/JEXL-372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17553261#comment-17553261 ] 

Dmitri Blinov edited comment on JEXL-372 at 6/12/22 2:22 PM:
-------------------------------------------------------------

The following use case returns 1 in JS
{code:java}
    @Test
    public void testIncrementOperatorOnNull() throws Exception {
        final JexlEngine jexl = new JexlBuilder().strict(false).create();
        JexlScript script;
        Object result;        script = jexl.createScript("var i = null; ++i");
        result = script.execute(null);
        Assert.assertEquals(1, result);
   }
 {code}
May be we should follow suit?


was (Author: dmitri_blinov):
The following test case returns 1 in JS
{code:java}
    @Test
    public void testIncrementOperatorOnNull() throws Exception {
        final JexlEngine jexl = new JexlBuilder().strict(false).create();
        JexlScript script;
        Object result;        script = jexl.createScript("var i = null; ++i");
        result = script.execute(null);
        Assert.assertEquals(1, result);
   }
 {code}
May be we should follow suit?

> Add support for 'standard' for loop
> -----------------------------------
>
>                 Key: JEXL-372
>                 URL: https://issues.apache.org/jira/browse/JEXL-372
>             Project: Commons JEXL
>          Issue Type: Improvement
>    Affects Versions: 3.2.1
>            Reporter: Henri Biestro
>            Assignee: Henri Biestro
>            Priority: Major
>             Fix For: 3.3
>
>
> It would be nice to allow the C/Javascript/Java for loop:
> for(init-expression; predicate-expression; step-expression) body
> This calls for the prefix/postfix increment/decrement operators.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)