d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Seeking Powershell Assistance, I Have 3 Errors > Hey
Add Reply New Topic New Poll
Member
Posts: 13,685
Joined: Mar 15 2008
Gold: 0.00
Sep 23 2015 05:27pm
Hey guys I'm doing a homework assignment and I can't for the life of me figured out what I did wrong, I tried to break it down and I believe there's 3 errors in the script and wondering if anyone can assist me a little bit. I'll post a pastebin here in a sec..

http://pastebin.com/3wC49CGr

Any help would be great!
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Sep 23 2015 05:36pm
Whats the issue?

edit: after looking at the code I see two issues:

Code
$correctAnswers = "b","d","c","a","c",


You have an extra comma at the end of that line. remove it, otherwise you are trying to add the rest of the script as an object in the array

Code
Write-Host " Question 6 was: `n ", $question6 ," `n Your answer was: `n " $answers[5] ," `n The correct answer was: `n " $correctAnswers[5] ," `n`n "

you only have 5 questions defined.


This post was edited by Minkomonster on Sep 23 2015 05:48pm
Member
Posts: 13,685
Joined: Mar 15 2008
Gold: 0.00
Sep 23 2015 06:06pm
LMAO, I was going through this like WTF DID I DO! And before I even viewed this I was scrutinizing it like -.- i'm like let's see there shouldn't be a comma here, nothing comes after it.... and it ran... -.- but yes Minko thank you, that was correct.

and yes I picked that one up as well before I reviewed the comment on here, sometimes if a line i know repeats i'll just copy and paste it a few times, had an extra line and a comma.. Hate programming lol.

This post was edited by Dragon0slaye on Sep 23 2015 06:07pm
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Sep 23 2015 06:21pm
Quote (Dragon0slaye @ Sep 23 2015 07:06pm)


and yes I picked that one up as well before I reviewed the comment on here, sometimes if a line i know repeats i'll just copy and paste it a few times, had an extra line and a comma.. Hate programming lol.


You should look into loops.

Member
Posts: 13,685
Joined: Mar 15 2008
Gold: 0.00
Sep 23 2015 06:28pm
Quote (Minkomonster @ Sep 23 2015 05:21pm)
You should look into loops.


I'm not that advanced yet haha. This is just a beginners class, i'm sure i'll get there.

This post was edited by Dragon0slaye on Sep 23 2015 06:28pm
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Sep 23 2015 06:35pm
Quote (Dragon0slaye @ Sep 23 2015 07:28pm)
I'm not that advanced yet haha. This is just a beginners class, i'm sure i'll get there.


Loops will probably be introduced in the coming lessons then. They are pretty basic constructs.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll