Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBikram Perhar
163 Pointshttps://w.trhou.se/wp7153p386 why when i enter 30 it says bash: 30: command not found
why when i enter 30 it says
8 Answers
Umesh Ravji
42,386 PointsHi Bikram, the problem appears to be that your code is missing a semi colon, preventing your program from compiling. Hence you are not actually running your program, and instead are typing 30
into the terminal, which isn't a valid command.
System.Console.Write("Enter how many minutes you exercised: ") // missing semi colon
treehouse:~/workspace$ mcs Program.cs
Program.cs(10,9): error CS1525: Unexpected symbol `string'
In order to run your program you must perform the following steps:
- Compile the code by writing in the terminal:
mcs Program.cs
- Run the program by writing into the terminal:
mono Program.exe
Bikram Perhar
163 Pointswhere do i miss the semi colon
Umesh Ravji
42,386 PointsOn this line..
System.Console.Write("Enter how many minutes you exercised: ")
Bikram Perhar
163 Pointsi put it in exactly as u type above
Umesh Ravji
42,386 PointsSystem.Console.Write("Enter how many minutes you exercised: "); // <-- semi colon goes right at the end :)
Nathanial Harmon
505 Pointssemi colon to finish the line. yes after the bracket
Bikram Perhar
163 PointsSystem.Console.Write("Enter how many minutes you exercised: ") I put it in exactly like you typed
Bikram Perhar
163 Pointslike this System.Console.Write("Enter how many minutes you exercised: ");
I feel so dumb
Umesh Ravji
42,386 PointsJust like that. Don't feel dumb, just learn from your mistakes :)
Bikram Perhar
163 Pointsok then i go mono Program.exe? Then what?
Mike Wagner
23,559 PointsYou first need to recompile the code after you added the missing semicolon. You can figure out how to do that by rewatching this or just glancing at the teacher notes on the video. Once it compiles properly, you should be able to run the program by typing what you just did into the Workspaces terminal. If you haven't changed anything but the semicolon since I looked at your code last, it will run fine and ask for how long you exercised, waiting for input, then it will close out once you provide the input (since you hadn't built the loop and exit functionality at that time).
Bikram Perhar
163 Pointsi watched the video then did this
To compile: mcs Program.cs
To run: mono Program.exe
still getting an error when i do the first one then when i do the second 1 and add enter still says bash 30 not found
Umesh Ravji
42,386 PointsHi Bikram, you have a colon, instead of a semi-colon at the end of the line I have mentioned below. Are you not getting that error when you are compiling your code? Since the code is not compiling properly, you are running an older version of Program.exe (which I recommend you just delete).
treehouse:~/workspace$ mcs Program.cs
Program.cs(10,42): error CS1525: Unexpected symbol `:', expecting `,' or `;'
Compilation failed: 1 error(s), 0 warnings
string entry = System.Console.ReadLine(); // you have a : instead of ;
Bikram Perhar
163 PointsI'm getting so frustrated I don't think I'm smart enough to to learn. I have so many ideas for apps but rather make them myself instead of paying someone to.
Mike Wagner
23,559 PointsMike Wagner
23,559 PointsUmesh Ravji - +1 for a solid catch. I missed it at first glance. Adding the semi-colon and recompiling the code allowed the program to run through a single cycle as expected with the existing code.
Umesh Ravji
42,386 PointsUmesh Ravji
42,386 PointsActually your answer was something I never considered and your right, the existing Program.exe simply printed the message to the console and finished running.
Mike Wagner
23,559 PointsMike Wagner
23,559 PointsUmesh Ravji - Honestly, after I read your answer and saw the missing semi-colon and your error report, I was rather surprised that it had compiled in the first place. Your answer was more accurate than mine, as fixing that issue also resolved the program to wait for input before closing. I hadn't considered it would be something like the semi-colon because the program actually had compiled enough to run when I tried to run it.
Bikram Perhar
163 PointsBikram Perhar
163 Pointsstill don't understand where am i missing the semi colon and when i put
// Prompt user for minutes exercised System.Console.Write("Enter how many minutes you exercised; ")
Where do i add it?
the semi colon is after the last bracket?