LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-24-2017, 12:53 PM   #16
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,302
Blog Entries: 13

Rep: Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696

Interesting point BW-userx about the programming structure, and BASIC.

Well, the OP thus far has not returned.
 
Old 03-24-2017, 01:08 PM   #17
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Xubuntu
Posts: 5,404

Rep: Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880
One point in favour of learning Python is that a lot of utility programs used by Linux distros are written in it.
 
1 members found this post helpful.
Old 03-24-2017, 01:19 PM   #18
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ Win10
Posts: 9,493

Rep: Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024
Quote:
Originally Posted by rtmistler View Post
Interesting point BW-userx about the programming structure, and BASIC.

Well, the OP thus far has not returned.
well that is my view on it, and I am not by any means a seasoned programmer, I have some schooling in c++ just before they changed the standard therefore the syntax itself too was changed. and Java but I never really used it, so rusty is an understatement. Only that what I leaned I use in BASH and C when I tinker in C as well as Pascal via Lazarus -- ie. structure and just the basic every languages (maybe not every one) uses loops, case statements, if statements, compounded if statements. etc just they write them differently
Code:
bash
if [ true ] ;
 then
do something
 fi
C
if ( true ) 
do something

Pascal
if true then
do something

Pascal block statement
if true then
begin
  Statement1;
  Statement2
end;
it is all the same only the syntax is different. https://www.tutorialspoint.com/compu...ing_syntax.htm
strangely repeats what I said basically.

Last edited by BW-userx; 03-24-2017 at 01:38 PM.
 
1 members found this post helpful.
Old 03-24-2017, 04:14 PM   #19
Myk267
Member
 
Registered: Apr 2012
Location: California
Posts: 422
Blog Entries: 16

Rep: Reputation: Disabled
Python is a fine first choice. There's lots of fine material about it online. If you happen to know someone in person who knows how to program and will teach you, learn whatever language they use.

Quote:
Originally Posted by BW-userx View Post
well that is my view on it, and I am not by any means a seasoned programmer, I have some schooling in c++ just before they changed the standard therefore the syntax itself too was changed. and Java but I never really used it, so rusty is an understatement. Only that what I leaned I use in BASH and C when I tinker in C as well as Pascal via Lazarus -- ie. structure and just the basic every languages (maybe not every one) uses loops, case statements, if statements, compounded if statements. etc just they write them differently
Code:
bash
if [ true ] ;
 then
do something
 fi
C
if ( true ) 
do something

Pascal
if true then
do something

Pascal block statement
if true then
begin
  Statement1;
  Statement2
end;
it is all the same only the syntax is different. https://www.tutorialspoint.com/compu...ing_syntax.htm
strangely repeats what I said basically.
Eh. Disagree.

Code:
if (true) {
do_something();
}
if (false) {
do_something_else();
}
The lack of 'then' or 'else' keywords makes these into 'parse errors' in one language I like, but I write this sort of thing in Javascript and Lua quite often.

Code:
procedure add1 (first_argument) {
  first_argument+1;
}
What does this do? It depends a lot on the language semantics, and it varies quite a bit, at least by the ones I know.

Code:
True == ""
In Python, the result of this is False. In Haskell, it's a type error.


Quote:
Originally Posted by BW-userx View Post
it is all the same only the syntax is different.
If the syntax is different, and the semantics are different, then what's similar at all?
 
1 members found this post helpful.
Old 03-24-2017, 05:03 PM   #20
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ Win10
Posts: 9,493

Rep: Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024
Quote:
Originally Posted by Myk267 View Post


If the syntax is different, and the semantics are different, then what's similar at all?
ohh gezz semantics vs syntax. the methodology or ideology. Whatever term you want to use to make it sound right in your head. every programming language is basically the same it all works off of true and has if, case, loops, Boolean and is used as a means to tell the CPU what to do. it is like speaking a different language to get someone to do something for you. it sounds different but it still is saying the same thing. The idea behind how to get it done is the same regardless of what language one uses. that is what makes it similar.

'copy file to path' can be written many different ways depending on what language one uses, the idea or need to do something is the same. take 4 different programming languages and write them out to do that operation.

You'll see that the similar is the coping of a file to a different place how one writes it is different. but still has a "if statement" I am sure for error checking and has to return true before it is executed. regardless if it is

'if (not true) then' or 'if (false) then' it still resolves to a true statement before it will be executed regardless of what programing language is used or how it has to be written by the specifications that the who ever designed the programming language says it has to be written for it to work.

rearguards if one has to write the 'then' or not that is up to the programming language designer. It all preforms the same functions. Even that is redefined by what language one is using.

functions return a value.
procedures do not.

Even though they both preform a function but not all Programming Languages require this division. C and C++ can have functions that do not return a value. Pascal calls them procedures.

If you cannot see the similarities within different programming languages that just boggles my mind. regardless it all gets broken down to zeros and ones in the end.

if they did not add a feature within the headers or api or whatever they want to call it that is used to be able to use the functions within the language then yeah not every language is going to accept
Code:
True == ""
True = NULL
True = '\0'
True == '0'
Javascript BTW is not even considered a programming Language.

Quote:
Search Results
JavaScript was not developed at Sun Microsystems, the home of Java. JavaScript was developed at Netscape. It was originally called LiveScript, but that name wasn't confusing enough. The -Script suffix suggests that it is not a real programming language, that a scripting language is less than a programming language.
Code:
if (true) {
do_something();
}
if (false) {
do_something_else();
}
I see no reason any programming language would throw an error if not using a else to do that. all that is is two different if statement checking for a true condition of something or even the same thing.

better written as such or should i say depending on the programming language it has to be written like this, but it still does the same thing.
Code:
if (true) {
do something ()<-- that indicates a function call
}

#all the brackets do is encase it. Not all programming languages require this for one line of execution. 

if (! true) {
then do something else
}
in every programming language it does the same. It checks for a true condition.

all the adding of the word else does is eliminate the need to write another complete if statement to check for that other true condition. The 'else' is then implied and not explicit is all.

Then someone came up with an idea to save writing and time to execute the code by designing the language to accept the word 'else' instead of having to write an entire different if statement to check for the other side of the condition which are BOOLEAN yes or no conditions. Which takes more time to run it through again to recheck it.

Code:
if (true) { 
do something
else
do something else if false 
}
it is either a yes or no condition, both are if statements, only had to eliminate the explicitness of the second if statement to cut down compile and execution time. one has to be in a true state. It cannot be both at the same time. if it is something else then something is wrong so throw an error.


Where some languages it has to be written like this.
Code:
if (true) 
{
do something
}
else
{
do something else if not true
}
that if statement is still there. only this time the if statement is now implied, and not the else.

if it is a no or not true then it is still a true condition that is being return.

A true in one or the other condition has to be achieved for the one or other to be executed. That is a similarity.

It all works the same regardless of how it has to be written.

so excuse me for not adding the word semantics to be more clear so as not to confuse another that cannot see what is similar between two different programming languages.

it it the programming itself the language one uses is just the means to get the something done.

break it down, the condition has to be true before it does something or it throws an error. regardless of what programing language one uses or scripting language (too) for that matter.

Last edited by BW-userx; 03-24-2017 at 06:44 PM.
 
1 members found this post helpful.
Old 03-24-2017, 07:23 PM   #21
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,302
Blog Entries: 13

Rep: Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696
Folks is it really effective to start a lengthy discussion about programming theory and discuss varying points of view with emphasis on your learned experiences in this thread? Those wishing to go off topic, please start a different thread.
 
1 members found this post helpful.
Old 03-24-2017, 11:04 PM   #22
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 4,367
Blog Entries: 3

Rep: Reputation: 2182Reputation: 2182Reputation: 2182Reputation: 2182Reputation: 2182Reputation: 2182Reputation: 2182Reputation: 2182Reputation: 2182Reputation: 2182Reputation: 2182
Quote:
Originally Posted by DavidMcCann View Post
One point in favour of learning Python is that a lot of utility programs used by Linux distros are written in it.
perl5 and python have that in common. Though I suspect that many of the python utilities are graphical and the perl5 utilities tend to be regular. A quick scan of one notebook XFCE shows a lot more perl utilities, if one is interested in numbers. It shows 303 vs 277 to be exact, but that's just my system. (I don't differentiate between python versons here, i.e. 2.x v 3.x) YMMV.

Code:
find / -type f -perm -111 -exec sh -c "head -n 5 {} | grep -q perl   && grep -H -m 1 'bin/perl' {}" \;   > /tmp/x.perl.txt
find / -type f -perm -111 -exec sh -c "head -n 5 {} | grep -q python && grep -H -m 1 'bin/python' {}" \; > /tmp/x.python.txt

wc -l /tmp/x.perl.txt
wc -l /tmp/x.python.txt
Of the two, perl5 is a bit more portable in that it is in the base system for many other operating systems. It's in OS X and OpenBSD for example. At least in the latter, python would have to be added from the package repository. However, there in the base system I find 54 perl5 utilities (454 if you count /usr/src).

Code:
find / -type f -perm -111 -exec sh -c "head -n 5 {} | grep -q perl && grep -H 'bin/perl' {}" \;   \
| sort -t : -k1,1 -u | grep -v /usr/src > /tmp/x.perl.txt

Last edited by Turbocapitalist; 03-25-2017 at 12:01 AM. Reason: /usr/src
 
Old 03-25-2017, 04:22 AM   #23
jamiebbbb
Member
 
Registered: Mar 2017
Location: Victoria, Australia
Distribution: Debian Wheezy
Posts: 34

Original Poster
Rep: Reputation: Disabled
Thanks for the feed back I am going to give Perl a whirl. I appreciate your help.
 
Old 03-25-2017, 05:32 AM   #24
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,383

Rep: Reputation: 3043Reputation: 3043Reputation: 3043Reputation: 3043Reputation: 3043Reputation: 3043Reputation: 3043Reputation: 3043Reputation: 3043Reputation: 3043Reputation: 3043
Some-one who thinks learning perl will be easy ?. Good on you ...
 
Old 03-25-2017, 07:26 AM   #25
jamiebbbb
Member
 
Registered: Mar 2017
Location: Victoria, Australia
Distribution: Debian Wheezy
Posts: 34

Original Poster
Rep: Reputation: Disabled
cant be any harder than assembly code.
 
Old 03-25-2017, 08:05 AM   #26
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
Lots of Perl public-library & FREE books!
Have FUN! I'm curious how you decided-on/picked Perl over Python/C/... [?] Here's CS
 
Old 03-27-2017, 02:26 AM   #27
art3m
LQ Newbie
 
Registered: Feb 2012
Location: Spokane, WA
Distribution: Debian Jessie, Kali Linux
Posts: 18

Rep: Reputation: Disabled
My first programming language was Java which I took in high school and got a certification which the school paid for. But then I discovered Python which was a dream come true. Whether you are into Security you can whip out quick scripts to do virtually whatever you want. You can use python to build a website and even build a full blown GUI application. It's simple to learn yet very powerful. Once you really learn the language it's amazing what you can do with Python. I would definitely recommend doing some research and at the very least giving it a try for a week or two. You will not be disappointed. Best of luck!

Here's a website it will get you started. That site helped me a lot getting started.

- art3m

Last edited by art3m; 03-27-2017 at 02:27 AM.
 
Old 04-02-2017, 03:48 PM   #28
jamiebbbb
Member
 
Registered: Mar 2017
Location: Victoria, Australia
Distribution: Debian Wheezy
Posts: 34

Original Poster
Rep: Reputation: Disabled
So far my adventure into Python have unearth majority of changes with syntax . Which is quite annoying. I can't understand why you would introduce a syntax change in every version .
For example
Python 2
Quote:
print 'Python', python_version()
print 'Hello, World!'
print('Hello, World!')
print "text", ; print 'print more text on the same line'
Python 2.7.6
Quote:
Python 2.7.6
Hello, World!
Hello, World!
text print more text on the same line
Python 3
Quote:
print('Python', python_version())
print('Hello, World!')

print("some text,", end="")
print(' print more text on the same line')
 
Old 04-02-2017, 03:59 PM   #29
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 19.1 MATE
Posts: 8,018
Blog Entries: 5

Rep: Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870
Quote:
Originally Posted by jamiebbbb View Post
So far my adventure into Python have unearth majority of changes with syntax. Which is quite annoying. I can't understand why you would introduce a syntax change in every version .
For example
Python 2

Python 2.7.6

Python 3
Simple: stick to the more up-to-date Python 3. There aren't syntax changes "every version" - this was a major version change with a rethink of the language between the two versions. It's easy enough to handle.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Hackety Hack: Toolkit to Make Learn the Ruby Programming Language Really Easy and Fun LXer Syndicated Linux News 0 03-11-2012 02:30 PM
Easy to learn server-side language? Ulysses_ Linux - Server 7 10-19-2010 12:38 PM
Programming language recommendation? joegumbo Programming 4 08-05-2009 11:44 PM
Need a language that is efficient, readable, easy to use and learn H_TeXMeX_H Programming 50 02-19-2008 01:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration