473,387 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Method syntax producing error

I am learning Ruby using codecademy and the current exercise tells the user to :

Define two methods in the editor:

A greeter method that takes a single string parameter, name, and returns a string greeting that person. (Make sure to use return and don't use print or puts.)

A by_three? method that takes a single integer parameter, number, and returns true if that number is evenly divisible by three and false if not. Remember, it's a Ruby best practice to end method names that produce boolean values with a question mark.

Based on that I came up with some code but it doesn't work and I do not know how to fix it or what I am missing. Any push in the right direction is greatly appreciated! Here is my code :

Expand|Select|Wrap|Line Numbers
  1. def greeter (name)
  3. name = gets.chomp
  4. return "Hi there #{name} sucka!"
  5. end
  7. def by_three(number)
  9. number = gets.chomp
  10. if number % 3 == 0
  11. return true
  12. else return false
  13. end
May 4 '13 #1
2 5810
nvm figured it out. Thx anyway!!
May 4 '13 #2
12,516 Expert Mod 8TB
Can you post your solution in case someone else runs into the same problem?
May 4 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: RK | last post by:
I am getting the "HTTP /1.1 405 - method not allowed" error when I am sending XML string over Msxml2.XMLHTTP object. I am sending data in POST, also passing querystring variable and here is the...
by: Dalan | last post by:
I can't seem to find a workaround of Query Syntax Error. Actually, the query performs just fine, except when the last record on a related subform is deleted, then it generates a Runtime Error 3075...
by: Karunakararao | last post by:
Hi All I'm using sybase database, I have a binary datatype column in a table, when I'm trying to store the char(128) value into that, I'm getting syntax violation error. If I take "w" as the...
by: Jeff Johnson | last post by:
I'm getting a Method Name Expected error when I try to compile. The error happens here: imgImage.Click += new ImageClickEventHandler(updateColours("X")); Can someone tell me what I'm doing...
by: KGarvin | last post by:
Open Visual Studio and create a new ASP.NET Web Services Project. Uncomment the test webmethod (Hello World) in the .asmx file, set as starup file, save and build project and run. Click on the...
by: Joel Finkel | last post by:
Folks, Sorry to take up bandwidth, but for the life of me I cannot see the syntax error in this code: Timer myTimer = new Timer(); myTimer.Tick += delegate { stopWaiting = true; };
by: Michael Bender | last post by:
Hello everybody, after reinstalling Windows XP (incl. IIS) it is not possible to create new webs on the local IIS in the likeweise reinstalled Visual Interdev 6.0. After typing in the name of...
by: sumanta123 | last post by:
Dear Sir when i am getting the value from properties file the the path showing of Issue.txt which is right. But in jsp in try block when pass SubjectofIssue path...
by: kokababu | last post by:
Hi, I have a simple rest web service which is running in the Tomcat. I tested my web service successfully using REST Client for FireFox. Now, I used PHP socket to post xml as string to my web...
by: Alex Dransfield | last post by:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace FindFactors { class Program {
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.