vendredi 25 septembre 2015

Creating a simple application involving iteration, and something is off. Likely an easy fix.

I am creating a simple application where I ask the user to specify which number to iterate to, and how many rows they want outputted. I think I'm really close, but fairly new at this, so I'm sure a little syntax and variable tweaking will get me there. I am creating this in .Net using MVC. I receive an error upon running because "x" and "y" names do not show up. Here is what I have:

<body>
<div> 

    @{


        var numCount = x;
        var colCount = y; 

        for (int i = 1; i < numCount; i++)
        {
            <span>@i</span>

            if (i % colCount == 0)
            {
                <br />
                    <form id="myForm">
                        How many numbers would you like to iterate to?
                        <br/>
                        <input id="x" type="text" name="x" />
                        <br/>
                        How many rows would you like in your iteration?
                        <br />
                        <input id="y" type="text" name="y" />
                        <br />
                        <input type="submit" value="Calculate!" onsubmit="return i()" />
                    </form>

            }
        }



    }

</div>

Aucun commentaire:

Enregistrer un commentaire