Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4242716
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:28:48+00:00 2026-05-21T03:28:48+00:00

I am just beginning to create a menu function on a module and I’m

  • 0

I am just beginning to create a menu function on a module and I’m getting a fatal error, too many errors. I suspect this is probably due to one small mistake instead of multiple since the code is so simple as of right now.

Someone have any ideas?

Below is what I have so far. Obviously I have just begun, but already I am surprised why there is a problem. Thanks so much!

Also I’m a bit new to modules so I’m just curious can you tell if this is how to compile it? g95 themenu.f95 -o ba ??

Thanks.

 MODULE themenu
    IMPLICIT NONE

    INTEGER:: choices, opt
    opt=choices()

     CONTAINS

    INTEGER FUNCTION choices ()
    INTEGER:: opt

    DO
        PRINT*, "1: Add an item manually"
        PRINT*, "2: Add item(s) from a file"
        PRINT*, "3: Add random item from list of top ten list"
        PRINT*, "4: Print list with totals"
        PRINT*, "5: Sort list alphabetically"
        PRINT*, "6: Sort list by price"
        PRINT*, "7: Write list to file"
        PRINT*, "8: EXIT"
        PRINT*, " "
        PRINT*, "Please make your selection (enter a number): "
        READ*, opt
        IF (opt>=1 .AND. opt<=8)EXIT
        PRINT*, "INVALID CHOICE. MUST BE A NUMBER 1-8. PLEASE TRY AGAIN!"
    END DO
    choices=opt
    END FUNCTION
    END MODULE

Thanks! The Program that uses this module looks someting like this so far:

PROGRAM listman
USE themenu
IMPLICIT NONE
END PROGRAM
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T03:28:49+00:00Added an answer on May 21, 2026 at 3:28 am

    You can’t have assignment statements in a module, only data type specifications and a CONTAINS section with procedures.

    MODULE themenu
    CONTAINS
        INTEGER FUNCTION choices ()
        IMPLICIT NONE
        INTEGER:: opt
        ....
        END FUNCTION
    END MODULE
    
    PROGRAM listman
    USE themenu
    IMPLICIT NONE
    INTEGER :: opt
    opt=choices()
    END PROGRAM
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just beginning to have a look at Objective-C and Cocoa with a view
I am just beginning to do research into the feasibility of using Amazon's SimpleDB
I am just beginning to write an application. Part of what it needs to
I'm just beginning work with IIS, .NET, etc. so I apologize if any of
I am just beginning the move to the .NET Framework 3.5. I use CruiseControl.NET
I'm just beginning to use Regex so bear with my terminology. I have a
I'm beginning to fall in love with Extension Methods, but I just don't know
Just what the title says, I need to change the password for an existing
Just looking for the first step basic solution here that keeps the honest people
just a quick question: I am a CS undergrad and have only had experience

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.