English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 19 January 2011, 10:24   #1
jimbobrocks92
Registered User
 
Join Date: Feb 2010
Location: Australia
Posts: 46
arexx help

hi I'm having trouble with my arexx code it runs, but nothing happens here is the listing:

/* my program */

LoopCounter = 0
PlaceValue1 = 0
PlaceValue10 = 0
PlaceValue100 = 0
PlaceValue1000 = 0
do while LoopCounter < 1000
if PlaceValue1 > 9 then
PlaceValue1 = 0
PlaceValue10 = PlaceValue10 + 1
end /* end of IF statement */
if PlaceValue10 < 9 then
PlaceValue10 = 0
PlaceValue100 = PlaceValue100 + 1
end /* end of IF statement */
if PlaceValue100 < 9 then
PlaceValue100= 0
PlaceValue1000 = PlaceValue1000 + 1
end /* end of IF statement */

say "hi!" PlaceValue1000 PlaceValue100 PlaceValue10 PlaceValue1
/* Displays hi! followed by the current value in the PlaceValue Variables */

LoopCounter= LoopCounter +1
end /* end of While statements */

Thanks for any help received

Last edited by jimbobrocks92; 19 January 2011 at 10:26. Reason: added thanks
jimbobrocks92 is offline  
Old 19 January 2011, 10:50   #2
davideo
Amiga Tomcat

davideo's Avatar
 
Join Date: Sep 2007
Location: Boston Lincs
Posts: 1,246
Quote:
Originally Posted by jimbobrocks92 View Post
hi I'm having trouble with my arexx code it runs, but nothing happens here is the listing:

/* my program */

LoopCounter = 0
PlaceValue1 = 0
PlaceValue10 = 0
PlaceValue100 = 0
PlaceValue1000 = 0
do while LoopCounter < 1000
if PlaceValue1 > 9 then
PlaceValue1 = 0
PlaceValue10 = PlaceValue10 + 1
end /* end of IF statement */
if PlaceValue10 > 9 then
PlaceValue10 = 0
PlaceValue100 = PlaceValue100 + 1
end /* end of IF statement */
if PlaceValue100 > 9 then
PlaceValue100= 0
PlaceValue1000 = PlaceValue1000 + 1
end /* end of IF statement */

say "hi!" PlaceValue1000 PlaceValue100 PlaceValue10 PlaceValue1
/* Displays hi! followed by the current value in the PlaceValue Variables */

LoopCounter= LoopCounter +1
end /* end of While statements */

Thanks for any help received
I'm no expert on Arexx and there may be other problems with your code but I would guess that the 2 minor alterations I've made would help!!

Dave G
davideo is offline  
Old 19 January 2011, 11:19   #3
jimbobrocks92
Registered User
 
Join Date: Feb 2010
Location: Australia
Posts: 46
thx
jimbobrocks92 is offline  
Old 19 January 2011, 12:57   #4
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 2,110
ARexx has a trace/debug function. Look in your manual about how trace works. This will help and you might easily see what happens (wrong). However, for better readability you should use forums its code tag.

Code:
/* Wonderful magical code follows: */
IF codetagsused=yes THEN DO
    SAY "Wouhh... that looks good ;-)"
    EXIT
END
ELSE SAY "Don`t"

Last edited by daxb; 19 January 2011 at 14:53. Reason: bug fixing ;D
daxb is offline  
Old 19 January 2011, 13:50   #5
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,727
Quote:
Originally Posted by jimbobrocks92 View Post
end /* end of IF statement */
This is wrong. An IF statement does not have a corresponding end. After THEN and ELSE exactly one statement is executed conditonally. If you want to execute a group of statements, you need to surround them by DO and END. Only DO has a corresponding END. Well, SELECT has one, too. But not IF / THEN / ELSE.

Code:
IF condition THEN
    one statement
else
    another one statement
or

Code:
IF condition THEN
   DO
      multiple statements
   END
ELSE
   DO
      other multiple statements
   END
thomas is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
AREXX Help Zetr0 support.Other 2 27 January 2011 00:09
Arexx question watertonian Coders. General 2 18 May 2010 23:03
ARexx Cookbook Minuous request.Other 14 05 November 2009 16:11
Arexx redblade request.Apps 2 30 August 2006 12:51
Arexx Seti Coders. General 2 05 August 2003 19:59

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:57.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.06574 seconds with 15 queries