Python Forum
question about various coding methods or names
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
question about various coding methods or names
#1
Newbie question . . . Why are there so many coding methods or names ,like PYTHON , RUBY ,etc. Doesn't the PC need to know what your using ( Python or Ruby ) when your coding or is it that all these methods use the same coding and do the same thing and it is just how it's presented ,when learning it.
If the PC does need to know what your using when your coding doesn't that make the PC have to do more then is needed to write a program,if each method is different but does the same final thing ?
In otherwords if your going to tell a PC to do something " that has the same outcome " weather you use Python or Ruby ,is the code the same in Python & Ruby for that outcome or different . . . if it is different ,why ? It's doing the same thing ,right ?
I could be totally "out" on this but please clarifiy ,Thank You.

Al
Reply
#2
A python file ends with .py, a ruby file ends with .rb, they are the filename extensions, the PC knows what to execute the file with from its filename extension.
Python and ruby languages are both written in another program, they each do certain things when they read through their respective .py or .rb file.

Here is a ruby file
hello_world.rb
puts "Hello World!"
If I try and run that in python it errors because it's not python code.
Error:
line 1 puts "Hello World!" ^ SyntaxError: invalid syntax
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020