Git Product home page Git Product logo

order-food's Introduction

About

This is a beginner's GOlang project. I have written a program using which you can order food in a restaurant.

Objective

  • Learn Go lang and build project as a beginner.
  • Enhance Go skills and learnings by building project.

Prerequisite

You should have basic knowledge of Go language like data types, if-else statement, loops, switch-statement, slices, maps and structures. If you don't know anything about Go language, then do checkout the resoruces section and you'll be good to go.

Resources

  1. Go Beginner Project Tutorial - Learn Golang
  2. Golang Tutorial for Beginners

Overview

Want to order food!? Well, you have come to the right place(not exactly :P).

This is a program which will help you order food in a restaurant named "Jaipur Bhojanalya".

You can order any item that is there in the menu, and as many times as you want. This program also lets you modify your order by allowing you to update quantity of an item, add an item in the order or delete an item from the order; before generating the final bill.

Key-topics

  • Golang basics
    • Fmt (Printf and Scan)
    • Variables and Data types
    • Type Conversion
    • String padding
    • Conditionals(if/else)
    • Switch Statement
    • Arrays and Slices
    • Maps
    • Structs

Learnings

There are several things that I learnt while building this project. I am sharing it, so that you can refer it if you get stuck.

  1. How to append in a slice of struct?

    Let say struct type name is NewStruct and we defined a new variable with the name a.

     type NewStruct struct{
     		   itemName string
     		   price uint
     		   quantity uint
     		}
     
     //To append use the below code: 
    
     a = append(a, NewStruct{itemName: name, price: bill, quantity: noOfPlates}
    
  2. What happens when you loop through an string, slice, map?

    Read for-loop range and unexpected values range to clear your doubts.

  3. Time function : E.g., time.Now()

    • Read this article to gain more insights.
  4. Random function : E.g.,randIntn(500), rand.Seed(time.Now().Unix());

    • Refer to this if you get stuck
  5. Delete from a map : delete(mapName, key)

Sneak peek

Here are some screenshots of the program in running.

image image image image

order-food's People

Contributors

softcodenet avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.