Ignoring IF staments
Author |
Message |
nonamedude
|
Posted: Tue Jun 02, 2009 9:10 pm Post subject: Ignoring IF staments |
|
|
What is it you are trying to achieve?
Its the third time i try to post this lol.
Ignoring the if statement if the variable has no value, run the example to get a better view
What is the problem you are having?
Variable has no value
Describe what you have tried to solve this problem
No solutions yet
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>
Turing: |
var answer : int
var quantity : array 1 .. 2 of int
var vegetable : array 1 .. 2 of string
vegetable (1) := "cabbage"
vegetable (2) := "Carrot"
procedure me
put "Vegetable 1"
put "Vegetable 2"
put "What do u want?"
get answer
if answer = 1 then
put "how many do you want?" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%JUST AN EXAMPLE
get quantity (1)
else
if answer = 2 then
put "how many do you want?"
get quantity (2)
end if
end if
end me
procedure checkout
if quantity (1) > 1 then
put vegetable (2), "" : 16, 10, "Example"
end if
if quantity (2) > 1 then
put vegetable (2), "" : 16, 10, "Example"
end if
end checkout
me
checkout
|
Please specify what version of Turing you are using
<Answer Here> |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Diablo117
![](http://compsci.ca/v3/uploads/user_avatars/6345067144872e0c7b2cf1.jpg)
|
Posted: Tue Jun 02, 2009 9:17 pm Post subject: Re: Ignoring IF staments |
|
|
heh, stopping an if statement with an if statement?
if variable ~= 0 then
Code here
end if |
|
|
|
|
![](images/spacer.gif) |
nonamedude
|
Posted: Tue Jun 02, 2009 9:22 pm Post subject: Re: Ignoring IF staments |
|
|
yup thats works but i also figured another way lol it just popped into my head
declare the value at the beggining
quantity (1):=0
quantity (2):=0
ty very much
btw is there a way to delete this post? |
|
|
|
|
![](images/spacer.gif) |
Diablo117
![](http://compsci.ca/v3/uploads/user_avatars/6345067144872e0c7b2cf1.jpg)
|
Posted: Tue Jun 02, 2009 9:24 pm Post subject: Re: Ignoring IF staments |
|
|
You could lock it if you were admin, but thats more work then it's worth. It will just die by itsself until a young necromancer comes along and raises it from the dead. Just say that your problem was solved then it should be fine. |
|
|
|
|
![](images/spacer.gif) |
avakann
|
Posted: Thu Jun 04, 2009 12:37 pm Post subject: Re: Ignoring IF staments |
|
|
my programme is ignoring the if statement and I don't want it to ignore it |
|
|
|
|
![](images/spacer.gif) |
|
|