Error cs1513 ожидалось

I am getting an error at run time when viewing my ASP.NET page in the browser. I am not getting any build errors however I am getting the following compiler error at runtime: Compilation Error

I am getting an error at run time when viewing my ASP.NET page in the browser. I am not getting any build errors however I am getting the following compiler error at runtime:

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1513: } expected

Source Error:


Line 329:            #line hidden
Line 330:            __output.Write("rnttt</div>rntt");
Line 331:        }
Line 332:        
Line 333:        private System.Web.UI.Control __BuildControl__control7() {

Source File: c:WindowsMicrosoft.NETFrameworkv1.1.4322
    Temporary ASP.NET Filesxxxxxxxx450ffa78d46d847d
    k1gsz9dj.0.cs    Line: 331 

I cannot locate any missing } in my source code and this error is occurring in the generated code files that exist in the Temporary ASP.NET Files directory. How can I trace this to the line of code that is actually malformed in my page or user controls on my page?

Chris Marisic's user avatar

Chris Marisic

32.2k24 gold badges164 silver badges257 bronze badges

asked Feb 23, 2012 at 3:52

Tiger's user avatar

8

If the error code related as following:

A variable name same as reserved word then you can rename variable.

A code segment such as:

@model MyModel
{
    var appname = @Model.Apps.FirstOrDefault(x => x.ID == Model.SelectedApp);
}

Remove ‘@’ coming before Model.Apps.FirstOrDefault(x => x.ID == Model.SelectedApp)

A code segment or section usage such as:

@section{ 
    <!-- hiiii it's not about an error -->
}

Remove the apostrophe from comment in section.

If it is none of these specific cases you can attempt to locate where the error is generated by applying a source reduction. Delete/cut/comment out pieces of code until you can reliably turn the error off and on. The code that turns the error on is likely the culprit if it is not one of the above situations.

Chris Marisic's user avatar

Chris Marisic

32.2k24 gold badges164 silver badges257 bronze badges

answered Nov 13, 2013 at 9:05

Suresh Mahawar's user avatar

1

Look in the markup (aspx or ascx) for blocks like:

<% ... some C# code.... { %>

   markup(controls, html etc)

<% } %>

Any opened bracket { needs to be closed with another bracket }.

These pages or controls are compiled once by ASP .Net when they are first requested.
Visual Studio doesn’t compile aspx or ascx files.

If the project is «Web Site» type, Visual Studio compiles the aspx/ascx files, but if the project is «Web Application» type Visual Studio doesn’t «compile» the markup (it does not generate the corresponding classes to the aspx/ascx markup)

answered Feb 23, 2012 at 5:42

Adrian Iftode's user avatar

Adrian IftodeAdrian Iftode

15.4k3 gold badges47 silver badges72 bronze badges

1

On my site, the problem was caused by a block of code that looked like this:

            @{  
                var currentNode = @linkedList.Find(@CurrentPage);
                if (@currentNode.Next != null)
                {
                    var next = @currentNode.Next;
                    <li>
                        @next.Name
                    </li>
                }
                if (@currentNode.Previous != null)
                {
                    var prev = @currentNode.Previous;
                    <li>
                        @prev.Name
                    </li>
                }
            }

I’m not sure why the problem was caused by the nesting. This may be a bug in the compiler.

answered Aug 29, 2014 at 8:03

devinbost's user avatar

devinbostdevinbost

4,5302 gold badges42 silver badges50 bronze badges

1

I got a similar problem and oculd find it only after a log of trial and error.

The error I made was to add a ‘@’ to variables inside a foreach loop which started with:

@foreach

answered Oct 25, 2016 at 14:48

AnotherOther's user avatar

Well as the error suggests, you are missing a closing curly brace ‘}’

Have a look at the msdn compiler errors documentation:

  • http://msdn.microsoft.com/en-us/library/83ht1k63(v=vs.80).aspx

As in the example on MSDN:

// the below will cause CS1513 since namespace is missing '}'
namespace y    
{
   class x
   {
      public static void Main()
      {
      }
   }

answered Feb 23, 2012 at 4:39

skub's user avatar

skubskub

2,25623 silver badges33 bronze badges

1

try to compile it in visual studio. i think it will also show where the exact line of the code that has incomplete curly braces.

compilation error cs1513

answered Feb 23, 2012 at 5:10

NET Experts's user avatar

NET ExpertsNET Experts

1,49517 silver badges35 bronze badges

0

  • Remove From My Forums
  • Question

  • This is the last two statements of my coding:}// closing a class statement}//closing a void statement.

    No other errors. Message CS1513 three times repeated from csc compiler on the same line coding.

Answers

  • Hi Sandro

    Error CS1513 shows that the compiler expected
    a closing curly brace (}) that was not found.

    The following sample generates CS1513:

    // CS1513

    namespace y  
    // CS1513, no close curly brace

    {

      
    class x

      
    {

         
    public static void Main()

         
    {

         
    }

      
    }

    More information:
    http://msdn.microsoft.com/en-us/library/83ht1k63(VS.80).aspx

    If you still have any further concern , please post your code, we will try our best to help you to solve this issue.

    Best regards,

    Lucy


    Lucy Liu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by

      Thursday, June 2, 2011 8:35 AM

C++ Error 1513-1514

Всем привет, я новичок как в Unity так и в C++.
Прошу вашей помощи, импортировал ассет на что Unity пожаловался на скрипт, многие ошибки устранил но вот две ошибки не получается, вот эти «error CS1514: { expected и error CS1513: } expected»
Вот сам скрипт:

Используется csharp

using UnityEngine;
using CharacterMotor;
public class CharacterMotor;
public class StepsHandlerExample : MonoBehaviour
{
    private CharacterMotor charMot;
    private Vector3 displacement;
    private float iniBackSpeed;
    private float iniForSpeed;
    private float iniSideSpeed;
    private Vector3 lastPos;
    private float slowBackSpeed;
    private float slowForSpeed;
    private float slowSideSpeed;
    public float slowWalkVolume = 0.1f;
    private bool onetime;
    public float normalWalkRate = 0.7f;
    public float slowWalkRate = 1.5f;

    private void Start()
    {
        lastPos = transform.position;
        charMot = GetComponent<CharacterMotor>();
        iniForSpeed = charMot.movement.maxForwardSpeed;
        iniBackSpeed = charMot.movement.maxBackwardsSpeed;
        iniSideSpeed = charMot.movement.maxSidewaysSpeed;

        slowBackSpeed = charMot.movement.maxBackwardsSpeed 6.0f;
        slowForSpeed = charMot.movement.maxForwardSpeed 7.0f;
        slowSideSpeed = charMot.movement.maxSidewaysSpeed 5.0f;

    }

    private void Update()
    {
        if (Input.GetKey(KeyCode.LeftShift))
        {
            GetComponent<AudioSource>().volume = slowWalkVolume;
            charMot.movement.maxForwardSpeed = slowForSpeed;
            charMot.movement.maxBackwardsSpeed = slowBackSpeed;
            charMot.movement.maxSidewaysSpeed = slowSideSpeed;
            if (onetime)
            {
                onetime = false;
                CancelInvoke(«NormalWalk»);
                InvokeRepeating(«NormalWalk», 0f, slowWalkRate);
            }

        }
        else
        {
            GetComponent<AudioSource>().volume = 1f;
            charMot.movement.maxForwardSpeed = iniForSpeed;
            charMot.movement.maxBackwardsSpeed = iniBackSpeed;
            charMot.movement.maxSidewaysSpeed = iniSideSpeed;
            if (!onetime)
            {
                onetime = true;
                CancelInvoke(«NormalWalk»);
                InvokeRepeating(«NormalWalk», 0f, normalWalkRate);
            }

         
        }
    }

    private void NormalWalk()
    {
        displacement = transform.position lastPos;
        lastPos = transform.position;
        if (!charMot.IsJumping())
        {
            if (displacement.magnitude > 0.01)
            {
                if (!GetComponent<AudioSource>().isPlaying)
                {
                    GetComponent<AudioSource>().Play();
                }
            }
        }
    }

    private void OnGUI()
    {
        GUI.Box(new Rect(Screen.width/12, Screen.height (Screen.height/4), Screen.width/1.1f, Screen.height/5),
                  «Hold Left Shift to walk slowly without noise! see the difference if you run behind the enemy!»);
    }
}

Заранее всем спасибо большое.

Shram
UNец
 
Сообщения: 5
Зарегистрирован: 04 мар 2019, 14:02

Re: C++ Error 1513-1514

Сообщение 1max1 04 мар 2019, 15:16

Как насчет сходить уроки по с# почитать, глядишь сможешь отличать его от c++. К тому же, если ты и дальше планируешь развиваться, то код писать нужно в нормальной среде типа Visual Studio, которая будет подчеркивать строки с ошибками.
Что по твоему должна делать эта строка в твоем коде?

Используется csharp

public class CharacterMotor;

Конечно же ты не знаешь, потому что код-то не твой, ты его от куда-то взял в надежде на чудо, а разбираться не захотел :((

Аватара пользователя
1max1
Адепт
 
Сообщения: 5285
Зарегистрирован: 28 июн 2017, 10:51

Re: C++ Error 1513-1514

Сообщение Friend123 04 мар 2019, 17:09

1max1, улыбнул )))))

Аватара пользователя
Friend123
Старожил
 
Сообщения: 701
Зарегистрирован: 26 фев 2012, 22:12
Откуда: Тверь
  • ICQ

Re: C++ Error 1513-1514

Сообщение Shram 04 мар 2019, 18:32

1max1 писал(а):Как насчет сходить уроки по с# почитать, глядишь сможешь отличать его от c++. К тому же, если ты и дальше планируешь развиваться, то код писать нужно в нормальной среде типа Visual Studio, которая будет подчеркивать строки с ошибками.
Что по твоему должна делать эта строка в твоем коде?

Используется csharp

public class CharacterMotor;

Конечно же ты не знаешь, потому что код-то не твой, ты его от куда-то взял в надежде на чудо, а разбираться не захотел :((

Конечно не мой умник, читай внимательно ! Написано же что был импортирован ассет и было около 6-и ошибок, они ссылались на «CharacterMotor»
а когда я кидаю другой скрипт «CharacterMotor» тогда появдяется другая ошибка, «The type or namespace name ‘ParticleAnimator’ could not be found (are you missing a using directive or an assembly reference?»
Затем пришел к этим единственным ошибкам.
Но я вижу здесь все злые.

Shram
UNец
 
Сообщения: 5
Зарегистрирован: 04 мар 2019, 14:02

Re: C++ Error 1513-1514

Сообщение Friend123 04 мар 2019, 18:37

Shram писал(а):Но я вижу здесь все злые.

Это не мы злые, это вы, простите, задаете вопросы уровня 1 курса универа по программированию

Вот, если выдает ошибку, то в самой ошибке всегда сказано что не так, они все типовые. Простое гугление даст ответ в 10 раз быстрее, чем писать на форуме.

P.S. Как-то я думал всегда, что форумы для обсуждения сложных проблем. Ошибался видать.

Аватара пользователя
Friend123
Старожил
 
Сообщения: 701
Зарегистрирован: 26 фев 2012, 22:12
Откуда: Тверь
  • ICQ

Re: C++ Error 1513-1514

Сообщение Shram 04 мар 2019, 18:47

Friend123 писал(а):

Shram писал(а):Но я вижу здесь все злые.

Это не мы злые, это вы, простите, задаете вопросы уровня 1 курса универа по программированию

Вот, если выдает ошибку, то в самой ошибке всегда сказано что не так, они все типовые. Простое гугление даст ответ в 10 раз быстрее, чем писать на форуме.

P.S. Как-то я думал всегда, что форумы для обсуждения сложных проблем. Ошибался видать.

P.S. а я думал почемучка для этого и была создана.

Ну хорошо, смотрите я создал новый проект импортировал ассет, на что он мне ответил ошибкой вот такую

«StepsHandlerExample.cs(5,13): error CS0246: The type or namespace name ‘CharacterMotor’ could not be found (are you missing a using directive or an assembly reference?»

И поверьте я пользовался «Google» проверил имя скрипта «CharacterMotor» совпадает, Google не чего не нашел.

Shram
UNец
 
Сообщения: 5
Зарегистрирован: 04 мар 2019, 14:02

Re: C++ Error 1513-1514

Сообщение 1max1 04 мар 2019, 19:40

Похоже автор твоего ассета забыл добавить скрипт CharacterMotor))

И поверьте я пользовался «Google» проверил имя скрипта «CharacterMotor» совпадает, Google не чего не нашел.

Что-то я тебе не верю)))

http://wiki.unity3d.com/index.php/CharacterMotor

Аватара пользователя
1max1
Адепт
 
Сообщения: 5285
Зарегистрирован: 28 июн 2017, 10:51

Re: C++ Error 1513-1514

Сообщение Shram 04 мар 2019, 19:57

1max1 писал(а):Похоже автор твоего ассета забыл добавить скрипт CharacterMotor))

И поверьте я пользовался «Google» проверил имя скрипта «CharacterMotor» совпадает, Google не чего не нашел.

Что-то я тебе не верю)))

http://wiki.unity3d.com/index.php/CharacterMotor

Этот скрипт я находил и добавлял, но все же спасибо, но теперь вылезли еще ошибки, суть их схожая

«The type or namespace name ‘ParticleAnimator’ could not be found (are you missing a using directive or an assembly reference?»

Теперь я понял что значит Не удалось найти ссылка на сборку, нет тупа скрипта, я ведь правельно все понял ? Значит уже два скрипта он забыл положить ?

Shram
UNец
 
Сообщения: 5
Зарегистрирован: 04 мар 2019, 14:02


Re: C++ Error 1513-1514

Сообщение Shram 04 мар 2019, 20:36

Ну да точно, ассет требует версию 4.6 теперь все понял.
Спасибо большое, вот теперь есть не большой как в скриптах так и в юнити.

Shram
UNец
 
Сообщения: 5
Зарегистрирован: 04 мар 2019, 14:02


Вернуться в Почемучка

Кто сейчас на конференции

Сейчас этот форум просматривают: Google [Bot] и гости: 31



Содержание

  1. Error cs1513 expected что это
  2. Answered by:
  3. Question
  4. Answers
  5. Error cs1513 expected что это
  6. Answered by:
  7. Question
  8. Answers
  9. All replies
  10. Error cs1513 expected что это
  11. Answered by:
  12. Question
  13. Answers
  14. All replies
  15. Error cs1513 expected что это
  16. Answered by:
  17. Question
  18. Answers

Error cs1513 expected что это

Answered by:

Question

This is the last two statements of my coding:>// closing a class statement>//closing a void statement.

No other errors. Message CS1513 three times repeated from csc compiler on the same line coding.

Answers

Error CS1513 shows that t he compiler expected a closing curly brace (>) that was not found.

The following sample generates CS1513:

namespace y // CS1513, no close curly brace

public static void Main()

If you still have any further concern , please post your code, we will try our best to help you to solve this issue.

Lucy Liu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Источник

Error cs1513 expected что это

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

I am just starting university and have begun programming in C#, I have just run into an issue that I am unsure how to fix where compiling states that a > is expected on line 37, but when I fix this, a multitude of errors occur stating that:

A local or parameter named ‘Percentage’ cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
Cannot convert lambda expression to type ‘bool’ because it is not a delegate type

Below is the area of code that is being changed

Any help regarding this error would be greatly appreciated

Answers

Try casting the values as floats:

The proper format of if with else if is in the link.

Here is the proper syntax:

You will have to rename the parameter «Percentage» to something like «percentage». The error tells you it is already used.

Let me know if that helps!

You hit an else before you hit a closing bracket here:

Control structures either govern the next block defined by brackets or only the code until the next Semikolon (wich means one line).

Your code put’s the else inside the if block. It is actually a peer of the if.

I guess you are missing closing bracket for if condition and else if condition. And else if end with else condition. Please try below code.

Hope this helps you.

I have tried your suggestions and I am now getting the error that occurred before when I tested it, with the command prompt outputting:

error CS0136: A local or parameter named ‘percentage’ cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
error CS1660: Cannot convert lambda expression to type ‘bool’ because it is not a delegate type

Throughout the document, adding the curly bracket seems to break the program even worse.

Is this an easier fix or does this make the problem worse?

How can that be without an «else if»?

You can do the else.

I have tried your suggestions and I am now getting the error that occurred before when I tested it, with the command prompt outputting:

error CS0136: A local or parameter named ‘percentage’ cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
error CS1660: Cannot convert lambda expression to type ‘bool’ because it is not a delegate type

Throughout the document, adding the curly bracket seems to break the program even worse.

Is this an easier fix or does this make the problem worse?

To fix the lambda problem, you must swat the «=>» to «>=» like in my code sample above.

Try renaming the Percentage variable just in the sample code you provided, or change » float Percentage = ( NumberofMarksInt / 70 ) * 100 ; » to » Percentage = ( NumberofMarksInt / 70 ) * 100 ; «. Drop the float in front of it. It was already defined.

That should fix it for you.

A control sturcture — be it an if, else, try, catch, switch, case, for or while — needs a clear definition for wich part of the code it applies. Indenting has no effect. Whitespaces have no effect.
You either define the area with curly brackets or it just takes everything until the next semikolon.

Without the proper braketing (the code you wrote in your OP) the syntax was so broken, the compiler could not even get to the real errors when looking at the code.
It was too broken to even properly find the real errors.

After you fixed the faulty brakets, you can now go deal with the real issues. Namely:

error CS0136: A local or parameter named ‘percentage’ cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
error CS1660: Cannot convert lambda expression to type ‘bool’ because it is not a delegate type

CS0136 implies you already had a variable of that name defined. Show us the rest of your code, we might be able to spot it.

CS1660 complains about this combination «=>» That is the character combination that starts a lambda expression, not the «>=» (more or equal) sign. And lambdas really don’t belong into a if.

Источник

Error cs1513 expected что это

Answered by:

Question

Not sure why I am getting this error

This code has been in use for over a year, recently changed host and now getting compile error — error CS1513: > expected

Here is the code, which looks balanced for curly braces to me.

It is asking for another closing curly brace at the end.

Is this an issue of Webmatrix1 vs Webmatrix2 ?

Any help please — much appreciated.

Answers

My only thought is that something within the Layout page is causing this to occur.

I tried moving around some of the braces in the Layout page to see if that made any difference at all :

It’s possible that the semicolon issue is coming down from the Layout and the error is only been seen on the child-page level.

Do you have any other code that might be interferring with this? (The @ symbol can often throw off the curly braces and cause them to «miss» one another)

I tried the following code that you had below and it appeared to work just fine :

Thaks Rion
Yes it goes into another block as follows

The logic is if user is logged in then show their GiftAid status (which can be yes or no) else show the

Do you only need to display the actual

area or all of the code behind it?

Example with just Gift Aid

Example with entire section

(I removed the trailing ‘;’ after your RenderPage call, although I’m not around an environment to test it.)

removed the trailing ; but webmatrix still not happy and want another > at the end of first block of code — it gives line number and column number.

As I mentioned this code has been working for more than a year and now that I changed host this thing has cropped up, probably they have different compiler — Razor 2 ?

Ah you may want to ensure that you have the newest version of WebMatrix 2. (WebMatrix 3 was just released recently, although 2 should be sufficient)

Have you tried removing the Razor code blocks within your if-else blocks to see if that makes any difference at all? (Sometimes they can throw things off a bit) :

I did that and found out that it is the top code between @ < >that is the problem. The error goes away if I remove the top block but stays if I remove the @if block.

I noticed that before as well by the colour that it is not extending to the 2nd > where it should .

Regarding Webmatrix 2, yes I do have that uptodate which I regret because after the update the Webdeploy stopped working and hasn’t worked since despite pestering the hosts many times, and they say it is fine on their end. Therefore I changed the host and landed into more troubles, and webdeploy still dont work.

wasted a lot of time after the update without getting any real advantage.

Источник

Error cs1513 expected что это

Answered by:

Question

This is the last two statements of my coding:>// closing a class statement>//closing a void statement.

No other errors. Message CS1513 three times repeated from csc compiler on the same line coding.

Answers

Error CS1513 shows that t he compiler expected a closing curly brace (>) that was not found.

The following sample generates CS1513:

namespace y // CS1513, no close curly brace

public static void Main()

If you still have any further concern , please post your code, we will try our best to help you to solve this issue.

Lucy Liu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Источник

  • Remove From My Forums
  • Question

  •  int nuii, muii;
                Console.WriteLine(«Please enter a number: «);

                nuii = int.Parse(Console.ReadLine()); /*What is this*/

                Console.WriteLine(«Thank you.  One More: «);
                muii = int.Parse(Console.ReadLine());

                Console.WriteLine(«Adding the two numbers:  » + (nuii + muii));

                if (nuii + muii < 10 )
                {
                    Console.WriteLine(«Well Done»);

                    else

                    Console.WriteLine(«Not BAD»);
                    Console.ReadLine();

    I am getting a CS1513 error at «Console.WriteLine(«Well Done»);» I don’t know why

    Can anyone help? 

                                             

Answers

  • Hi.

    it is obvious that you lost something

    if (nuii + muii < 10 ) { Console.WriteLine("Well Done"); } //<<<==== you lost this guy. else

    { // <<<==== you lost this guy. Console.WriteLine("Not BAD"); Console.ReadLine();

    }//<<<==== you lost this guy.


    DON’T TRY SO HARD,THE BEST THINGS COME WHEN YOU LEAST EXPECT THEM TO.

    • Edited by

      Sunday, November 22, 2015 6:01 AM

    • Marked as answer by
      DotNet Wang
      Monday, November 30, 2015 9:40 AM

  • Similar to your other thread ;-)

    if (nuii + muii < 10 )
    {
        Console.WriteLine("Well Done");
    
        else
    
        Console.WriteLine("Not BAD");
        Console.ReadLine();

    Your ‘if’ has an unmatched opening curly brace; either remove the opening curly or at a closing curly.

    if (nuii + muii < 10 )
    {
        Console.WriteLine("Well Done");
    }
    
    OR
    
    if (nuii + muii < 10 )
        Console.WriteLine("Well Done");
    

    Also your indentations are confusing. Looking at it, it
    looks like you expect
    the ReadLine only to be executed in the else. That is not the case.

    To prevent any confusion, you should be consistent in indentations (VS actually makes it easy).

    if (nuii + muii < 10 )
        Console.WriteLine("Well Done");
    else
        Console.WriteLine("Not BAD");
    
    Console.ReadLine();
    

    This, for me, makes it clear that ReadLine does not belong to the else as it is not indented and there is an empty line. Alternative is to use curly braces everywhere in this part of your code.

    if (nuii + muii < 10 )
    {
        Console.WriteLine("Well Done");
    }
    else
    {
        Console.WriteLine("Not BAD");
    }
    
    Console.ReadLine();
    

    Note: the editor that you use to post a message on the this forum has a little symbol in the toolbar with <>; use that when posting a block of code.

    • Marked as answer by
      DotNet Wang
      Monday, November 30, 2015 9:40 AM

  • Hi,

    Compiler Error CS1513 occurs when compiler expected a closing curly brace (})
    that was not found. Hope this hlps you.

    Compiler Error CS1513

    Thanks,

    Sabah Shariq

    • Marked as answer by
      DotNet Wang
      Monday, November 30, 2015 9:40 AM

  • Remove From My Forums
  • Question

  •  int nuii, muii;
                Console.WriteLine(«Please enter a number: «);

                nuii = int.Parse(Console.ReadLine()); /*What is this*/

                Console.WriteLine(«Thank you.  One More: «);
                muii = int.Parse(Console.ReadLine());

                Console.WriteLine(«Adding the two numbers:  » + (nuii + muii));

                if (nuii + muii < 10 )
                {
                    Console.WriteLine(«Well Done»);

                    else

                    Console.WriteLine(«Not BAD»);
                    Console.ReadLine();

    I am getting a CS1513 error at «Console.WriteLine(«Well Done»);» I don’t know why

    Can anyone help? 

                                             

Answers

  • Hi.

    it is obvious that you lost something

    if (nuii + muii < 10 ) { Console.WriteLine("Well Done"); } //<<<==== you lost this guy. else

    { // <<<==== you lost this guy. Console.WriteLine("Not BAD"); Console.ReadLine();

    }//<<<==== you lost this guy.


    DON’T TRY SO HARD,THE BEST THINGS COME WHEN YOU LEAST EXPECT THEM TO.

    • Edited by

      Sunday, November 22, 2015 6:01 AM

    • Marked as answer by
      DotNet Wang
      Monday, November 30, 2015 9:40 AM

  • Similar to your other thread ;-)

    if (nuii + muii < 10 )
    {
        Console.WriteLine("Well Done");
    
        else
    
        Console.WriteLine("Not BAD");
        Console.ReadLine();

    Your ‘if’ has an unmatched opening curly brace; either remove the opening curly or at a closing curly.

    if (nuii + muii < 10 )
    {
        Console.WriteLine("Well Done");
    }
    
    OR
    
    if (nuii + muii < 10 )
        Console.WriteLine("Well Done");
    

    Also your indentations are confusing. Looking at it, it
    looks like you expect
    the ReadLine only to be executed in the else. That is not the case.

    To prevent any confusion, you should be consistent in indentations (VS actually makes it easy).

    if (nuii + muii < 10 )
        Console.WriteLine("Well Done");
    else
        Console.WriteLine("Not BAD");
    
    Console.ReadLine();
    

    This, for me, makes it clear that ReadLine does not belong to the else as it is not indented and there is an empty line. Alternative is to use curly braces everywhere in this part of your code.

    if (nuii + muii < 10 )
    {
        Console.WriteLine("Well Done");
    }
    else
    {
        Console.WriteLine("Not BAD");
    }
    
    Console.ReadLine();
    

    Note: the editor that you use to post a message on the this forum has a little symbol in the toolbar with <>; use that when posting a block of code.

    • Marked as answer by
      DotNet Wang
      Monday, November 30, 2015 9:40 AM

  • Hi,

    Compiler Error CS1513 occurs when compiler expected a closing curly brace (})
    that was not found. Hope this hlps you.

    Compiler Error CS1513

    Thanks,

    Sabah Shariq

    • Marked as answer by
      DotNet Wang
      Monday, November 30, 2015 9:40 AM

StAsIk2008

0 / 0 / 0

Регистрация: 20.02.2020

Сообщений: 1

1

20.02.2020, 13:09. Показов 12911. Ответов 3

Метки нет (Все метки)


вот скрипт

C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
using UnityEngine;
using System.Collections;
 
[RequireComponent(typeof(Rigidbody2D))]
 
public class Player2DControl : MonoBehaviour
{
 
    public enum ProjectAxis { onlyX = 0, xAndY = 1 };
    public ProjectAxis projectAxis = ProjectAxis.onlyX;
    public float speed = 150;
    public float addForce = 7;
    public bool lookAtCursor;
    public KeyCode leftButton = KeyCode.A;
    public KeyCode rightButton = KeyCode.D;
    public KeyCode upButton = KeyCode.W;
    public KeyCode downButton = KeyCode.S;
    public KeyCode addForceButton = KeyCode.Space;
    public bool isFacingRight = true;
    private Vector3 direction;
    private float vertical;
    private float horizontal;
    private Rigidbody2D body;
    private float rotationY;
    private bool jump;
 
    void Start()
    {
        body = GetComponent<Rigidbody2D>();
        body.fixedAngle = true;
 
        if (projectAxis == ProjectAxis.xAndY)
        {
            body.gravityScale = 0;
            body.drag = 10;
        }
    }
 
    void OnCollisionStay2D(Collision2D coll)
    {
        if (coll.transform.tag == "Ground")
        {
            body.drag = 10;
            jump = true;
        }
    }
 
    void OnCollisionExit2D(Collision2D coll)
    {
        if (coll.transform.tag == "Ground")
        {
            body.drag = 0;
            jump = false;
        }
    }
 
    void FixedUpdate()
    {
        body.AddForce(direction * body.mass * speed);
 
        if (Mathf.Abs(body.velocity.x) > speed / 100f)
        {
            body.velocity = new Vector2(Mathf.Sign(body.velocity.x) * speed / 100f, body.velocity.y);
        }
 
        if (projectAxis == ProjectAxis.xAndY)
        {
            if (Mathf.Abs(body.velocity.y) > speed / 100f)
            {
                body.velocity = new Vector2(body.velocity.x, Mathf.Sign(body.velocity.y) * speed / 100f);
            }
        }
        else
        {
            if (Input.GetKey(addForceButton) && jump)
            {
                body.velocity = new Vector2(0, addForce);
            }
        }
    }
 
    void Flip()
    {
        if (projectAxis == ProjectAxis.onlyX)
        {
            isFacingRight = !isFacingRight;
            Vector3 theScale = transform.localScale;
            theScale.x *= -1;
            transform.localScale = theScale;
        }
    }
 
    void Update()
    {
        if (lookAtCursor)
        {
            Vector3 lookPos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, Camera.main.transform.position.z));
            lookPos = lookPos - transform.position;
            float angle = Mathf.Atan2(lookPos.y, lookPos.x) * Mathf.Rad2Deg;
            transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
        }
 
        if (Input.GetKey(upButton)) vertical = 1;
        else if (Input.GetKey(downButton)) vertical = -1; else vertical = 0;
 
        if (Input.GetKey(leftButton)) horizontal = -1;
        else if (Input.GetKey(rightButton)) horizontal = 1; else horizontal = 0;
 
        if (projectAxis == ProjectAxis.onlyX)
        {
            direction = new Vector2(horizontal, 0);
        }
        else
        {
            if (Input.GetKeyDown(addForceButton)) speed += addForce; else if (Input.GetKeyUp(addForceButton)) speed -= addForce;
            direction = new Vector2(horizontal, vertical);
        }
 
        if (horizontal > 0 && !isFacingRight) Flip(); else if (horizontal < 0 && isFacingRight) Flip();

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



управление сложностью

1687 / 1300 / 259

Регистрация: 22.03.2015

Сообщений: 7,545

Записей в блоге: 5

20.02.2020, 13:38

2

Пропущена закрывающая скобка, либо лишняя открывающая



0



11 / 9 / 8

Регистрация: 08.05.2013

Сообщений: 139

20.02.2020, 14:55

3

На какую строку ругается?



0



0 / 0 / 0

Регистрация: 17.02.2020

Сообщений: 87

24.02.2020, 11:53

4

В конец поставь знак }



0



I was programming (C#) a day/night cycle system for my unity game when I got the following error:
AssetsScriptsRotate.cs(15,6): error CS1513: } expected

My code should calculate a ‘time’ in minutes from the rotation of the sun (Which is attached to this object).

Here is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Rotate : MonoBehaviour
{
	public float timescale=1f;
	private int hour=12;
	private int minute=0;
    void Start()
    {
		StartCoroutine("TickUpdate");
    }
	public IEnumerator TickUpdate()
    {
		private string stringbuffer1;
		for(;;)
		{
			private float RotationSpeed 0.0025*timescale
			gameObject.transform.Rotate(RotationSpeed,0f,0f);
			public float RawMinute=0.00694444444444444444444444444444f*(gameObject.transform.rotation.x-90);
			public string time="{hour}:{minute}";
			yield return new WaitForSeconds(.01f);
		}
	}
}

I already checked multiple sites and the unity answers form.
Any help would be appericiated.

(I’m using Notepad++ as my editor)

Понравилась статья? Поделить с друзьями:
  • Error cs1513 как исправить
  • Error cs1513 expected unity что делать
  • Error cs1503 unity
  • Error cs1503 argument 2 cannot convert from unityengine vector3 to unityengine transform
  • Error cs1503 argument 2 cannot convert from double to float