Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °
| |
|
|
You are not logged in. #1 2013-01-22 07:36:33
EndIf is If?Someone help me! Code:TextWindow.WriteLine("Testing")
test = TextWindow.Read()
If test = "Testing Reply" Then
TextWindow.WriteLine("This is text.")
Else
TextWindow.WriteLine("Sorry, this operation did not perform correctly.")
EndIfit always displays the Else even when I type in "Testing Reply." Last edited by n872yt3r (2013-01-22 07:47:05) - n872yt3r Math Is Fun Rocks! By the power of the exponent, I square and cube you! #2 2013-01-22 09:06:33
Re: EndIf is If?hi n872yt3r
If that is literal then they aren't the same. The input has a full stop. You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei #3 2013-01-22 09:21:00
Re: EndIf is If?No, the period was marked as the end of a sentence. Anyway, that was just an example, if I do it in real time and enter it exactly correctly, so yeah, it's got to be a variable dump. - n872yt3r Math Is Fun Rocks! By the power of the exponent, I square and cube you! #4 2013-01-22 23:09:41
Re: EndIf is If?Hi, "Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense" - Buddha? "Data! Data! Data!" he cried impatiently. "I can't make bricks without clay." #6 2013-01-22 23:29:09
Re: EndIf is If?Hi, "Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense" - Buddha? "Data! Data! Data!" he cried impatiently. "I can't make bricks without clay." #8 2013-01-23 00:25:07
Re: EndIf is If?Hey n872yt3r Code:If test == "Testing Reply" Then Put two equal signs there 'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.' 'God exists because Mathematics is consistent, and the devil exists because we cannot prove it' 'The whole person changes, why can't a habit?' -65 #9 2013-01-23 00:35:17
Re: EndIf is If?2 = signs? According to Microsoft Small Basic Curriculum Lesson 1.4, (here is just an example:) you can do Code:If Clock.Day = 1 And Clock.Month = 1 Then
TextWindow.WriteLine("Happy New Year!")
EndIf'Ya see? Clock.Day = 1 and Month = 1. 1 equals sign. - n872yt3r Math Is Fun Rocks! By the power of the exponent, I square and cube you! #10 2013-01-23 00:41:11
Re: EndIf is If?Try 2 = signs anyway 'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.' 'God exists because Mathematics is consistent, and the devil exists because we cannot prove it' 'The whole person changes, why can't a habit?' -65 #12 2013-01-23 01:06:15
Re: EndIf is If?Have you understood what gAr said? 'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.' 'God exists because Mathematics is consistent, and the devil exists because we cannot prove it' 'The whole person changes, why can't a habit?' -65 #13 2013-01-23 01:11:34
Re: EndIf is If?Hi; In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #16 2013-01-24 23:04:28
Re: EndIf is If?ElseIfs... Sure! It was like this... Code:TextWindow.WriteLine("Testing")
test = TextWindow.Read()
If test = "Testing Reply" Then
TextWindow.WriteLine("This is text.")
ElseIf
test2 = TextWindow.Read()
If test2 = "Testing Reply 2" Then
TextWindow.WriteLine("This is also text.")
Else
TextWindow.WriteLine("Sorry, this operation did not perform correctly.")
EndIfAnd it never works! - n872yt3r Math Is Fun Rocks! By the power of the exponent, I square and cube you! #17 2013-01-25 02:05:06
Re: EndIf is If?Here's your main problem: Code:ElseIf test2 = TextWindow.Read() If test2 = "Testing Reply 2" Then You need to put your test on the same line as the 'ElseIf' like this: Code:ElseIf test2 = TextWindow.Read() If test2 = "Testing Reply 2" Then And immediately after the test, Small Basic is expecting a "Then," just like with the if statements: Code:ElseIf test2 = TextWindow.Read() Then If test2 = "Testing Reply 2" Then Also, you can't test if TextWindow.Read() is equal to the variable 'test2' because you haven't set it to anything yet. But you already set the "test" variable to TextWindow.Read() on the second line of your program. What I think you meant to do is something like this: Code:ElseIf test = "Testing Reply 2" Then Finally, with all that thinking, we get this: Code:TextWindow.WriteLine("Testing")
test = TextWindow.Read()
If test = "Testing Reply" Then
TextWindow.WriteLine("This is text.")
ElseIf test = "Testing Reply 2" Then
TextWindow.WriteLine("This is also text.")
Else
TextWindow.WriteLine("Sorry, this operation did not perform correctly.")
EndIfLine by line, the program says this: Last edited by muxdemux (2013-01-25 02:19:46) |