Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

for Loop Error

Discussion in 'Scripting' started by LegendaryAccount, Jun 9, 2015.

  1. LegendaryAccount

    LegendaryAccount

    Joined:
    Jun 9, 2015
    Posts:
    10
    #pragma strict

    function Start () {
    for(int i = 0; i < 100; i++){
    Debug.Log(i);
    }
    }

    Errors:
    Assets/NewBehaviourScript.js(4,17): BCE0044: expecting ;, found 'i'.
    Assets/NewBehaviourScript.js(4,36): BCE0043: Unexpected token: ).
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    using unityscript you would need

    Code (csharp):
    1.  
    2. var i : int = 0
    3.  
    you've used the c# syntax
     
  3. raibow

    raibow

    Joined:
    Apr 29, 2014
    Posts:
    4
    or just type
    Code (JavaScript):
    1. for(var i = 0; i < 100; i++){
    2. Debug.Log(i);
    3. }