New topic: 

Noob Syntax question

<http://forums.realsoftware.com/viewtopic.php?t=37951>

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        Dillon907          Post subject: Noob Syntax questionPosted: Fri 
Mar 04, 2011 7:39 pm                         
Joined: Fri Sep 24, 2010 4:26 pm
Posts: 14                I'm working through the RB curriculum and they give 
the following code but it keeps coming back as a syntax error on the first line.

Code:  function RepeatString2(s as String, n as Integer) as String
  if n<=0 then
  return ""
  else
  return s+RepeatString2 (s, n-1)+EndOfLine
  end if
  

Any ideas?      
_________________
"You know you've grown up with nerds when you catch yourself defining a human 
according to D&D alignments." - Me  
                             Top                 timhare          Post subject: 
Re: Noob Syntax questionPosted: Fri Mar 04, 2011 7:55 pm                        
 
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 9386
Location: Portland, OR  USA                You don't actually type that first 
line into your project.

press Add Method
In the Method Name field, type in: RepeatString2
in the Parameters field, type in: s as String, n as Integer
in the Return Type field, type in: String

Type the body of the code into the code editor window.

Tim   
                             Top                briman          Post subject: 
Re: Noob Syntax questionPosted: Fri Mar 04, 2011 7:56 pm                        
         
Joined: Fri Sep 30, 2005 9:27 am
Posts: 128
Location: CA                Hi,

Just make sure you are creating the Function like this: RepeatString2

EDIT: Dang your fast Tim 
HTH      
_________________
-Briman  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to