Old Basic-New Basic
-
Monday, July 30, 2012 4:19 PM
Bot new computer, Windows7-Won't load my old GW-Basic disk- Trying Small Basic
a=5
b=cos(a)
TextWindow.WriteLine (b)
Response: Unexpected token (found
What's wrong? Thanks
All Replies
-
Monday, July 30, 2012 4:37 PM
There is a space between WriteLine and (b)
You must remove the space for it to work, like this : TextWindow.WriteLine(b)
- Proposed As Answer by Ed Price - MSFTMicrosoft Employee, Owner Tuesday, October 09, 2012 12:57 AM
- Marked As Answer by Ed Price - MSFTMicrosoft Employee, Owner Thursday, October 25, 2012 5:22 PM
- Unmarked As Answer by Ed Price - MSFTMicrosoft Employee, Owner Thursday, October 25, 2012 5:22 PM
- Unproposed As Answer by Ed Price - MSFTMicrosoft Employee, Owner Thursday, October 25, 2012 5:22 PM
-
Monday, July 30, 2012 5:31 PMAnswerer
You must remove the space for it to work...
AshkoreDracson, this is completely untrue! Small Basic accepts blank spaces almost anywhere!
Even TextWindow . WriteLine ( b ) is valid!!!
In SB, most of its operations and properties demand an object (or class) typed before them.
For example, TextWindow is written before WriteLine(), because the method/operation WriteLine() belongs to the class/object TextWindow.
In the BasicAl's case above, all mathematics methods belong to the class Math. So, b=cos(a) has to be b=Math.Cos(a).
Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)
- Edited by GoToLoopEditor Monday, July 30, 2012 5:31 PM
- Proposed As Answer by Ed Price - MSFTMicrosoft Employee, Owner Tuesday, October 09, 2012 12:57 AM
- Marked As Answer by Ed Price - MSFTMicrosoft Employee, Owner Thursday, October 25, 2012 5:22 PM
-
Monday, July 30, 2012 7:00 PMOh sorry, i didn't noticed that, the first thing I saw was the extra space, and i never tryed to insert a space between functions, so I tought it was because of that. :)
-
Thursday, October 18, 2012 3:44 AM
You also must use Math.GetRadians so that Small Basic can process the sine easier!
For example, for your code, you would have to write it like this:
a = 5 b = Math.Cos(Math.GetRadians(a)) TextWindow.WriteLine(b)
Does this help?
I am a 10 year old that loves math, games, and computers. 'Binary is as easy as 1, 10, 11.'
- Proposed As Answer by Math Man Thursday, October 18, 2012 3:44 AM
- Marked As Answer by Ed Price - MSFTMicrosoft Employee, Owner Thursday, October 25, 2012 5:23 PM

