Getting Snakey
Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 5388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Getting Snakey
I bought this in an airport bookshop . . . possibly the easiest, simplest intro I have seen for 12 Euros.
-
- Livecode Opensource Backer
- Posts: 5388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Getting Snakey
So . . . I am getting started with Python because market forces are pushing me that way
(fancy way of saying that parents here in Bulgaria have been asking if I can teach an "Intro to Python" course
for kiddos this summer: now I no longer have to lie.
)
From a personal point of view it is not a bad thing to look at Python as it throws up questions
about LiveCode . . .
(fancy way of saying that parents here in Bulgaria have been asking if I can teach an "Intro to Python" course
for kiddos this summer: now I no longer have to lie.

From a personal point of view it is not a bad thing to look at Python as it throws up questions
about LiveCode . . .
-
- Livecode Opensource Backer
- Posts: 5388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Getting Snakey
So; here we go . . .
- -
but I am not sure how to get non-floating point result in LiveCode.
- -
Code: Select all
put 99/2 -- 49.5
Code: Select all
put 99 mod 2 --remainder
Last edited by richmond62 on Sat Feb 15, 2020 2:46 pm, edited 3 times in total.
-
- Livecode Opensource Backer
- Posts: 5388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Getting Snakey
No:
I mean this:
99 / 2 = 49
I mean this:
99 / 2 = 49
-
- Livecode Opensource Backer
- Posts: 5388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Getting Snakey
What is the point of this?
-
-
-
- Livecode Opensource Backer
- Posts: 5388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Getting Snakey
Ouch . . . did some Assembly in 1984, and it was, frankly, pretty Orwellian!What... no assembly ?
Round these parts (Bulgaria) the voices I hear in my head are whispering "C++", "C#", "Java script" and "Python."
Interestingly enough no-one seems to be teaching Python; so, at the risk of slipping on a banana-skin I'm attempting
to fill a niche.
Frankly, in spit of the very, very clear Black Dog Magazine the whole thing feels like the PASCAL 5 I studied in 1984 . . .
retro and completely 'anal' about formatting, indenting and so on.
But, whatever my personal objections it is rather nice to open the fridge and find food there.

-
- Livecode Opensource Backer
- Posts: 5388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Getting Snakey
Oh, well, that isn't the first time . . .I'm sorry, I have no idea what you are talking about.

Re: Getting Snakey
Well, I like playing with assembly, since it was the first language I messed with. As long as you kept things moving smoothly through the registers, it all came out ok.
I also like Pascal (and Delphi) which came after it, I thought Borland did a fantastic job with it, and there were no surprises with how things worked. Not sure how you consider Pascal to be anal about formatting, but I see a lot in common between Lc and Delphi, especially in the syntax.
I agree you should have food in the fridge as well, but what I'm not sure I understand is, you said - before you edited the post, which was after I replied - that you were unsure how to get a remainder in Lc from division. You then put some (what I assume are) examples using print in Python. I put an example of division with a remainder.
After you edited your post, it looks like your not looking for remainders, even though 99/2 would leave a '.5' remainder. So now I am unsure what exactly your trying to accomplish
The point of your last example, using .upper appears to be the equivalent of Lc's toUpper (also could use 'upper') function, turning lower case into upper case. However, since I know you already know that, I really don't get where your going. Were you mixing vodka with your orange juice this morning ?
I also like Pascal (and Delphi) which came after it, I thought Borland did a fantastic job with it, and there were no surprises with how things worked. Not sure how you consider Pascal to be anal about formatting, but I see a lot in common between Lc and Delphi, especially in the syntax.
I agree you should have food in the fridge as well, but what I'm not sure I understand is, you said - before you edited the post, which was after I replied - that you were unsure how to get a remainder in Lc from division. You then put some (what I assume are) examples using print in Python. I put an example of division with a remainder.
After you edited your post, it looks like your not looking for remainders, even though 99/2 would leave a '.5' remainder. So now I am unsure what exactly your trying to accomplish

The point of your last example, using .upper appears to be the equivalent of Lc's toUpper (also could use 'upper') function, turning lower case into upper case. However, since I know you already know that, I really don't get where your going. Were you mixing vodka with your orange juice this morning ?

-
- Livecode Opensource Backer
- Posts: 5388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Getting Snakey
No Vodka this morning, nor, frankly this afternoon as I exist in a different time zone to thee.
Also: I do NOT drink Vodka; a drink that, presumably exists only for getting sloshed (after all it has very little taste) strikes
me as fairly foul.
I have never seen any value in something that changes everything to upper case or the other way round.

Also: I do NOT drink Vodka; a drink that, presumably exists only for getting sloshed (after all it has very little taste) strikes
me as fairly foul.
I have never seen any value in something that changes everything to upper case or the other way round.
Last edited by richmond62 on Sat Feb 15, 2020 5:28 pm, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 5388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Getting Snakey
as to this:-
- -
The first thing performs a floating-point division.
The second thing performs a a division that rounds DOWN to an integer.
The third thing performs a a division that rounds DOWN to an integer and then gives you the REMAINDER.
Now I know how to perform the first and the third operation, but not the second in LiveCode,
and as those operationsin Python are explained on "page 2" of that magazine (page 43).
.
- -
The first thing performs a floating-point division.
The second thing performs a a division that rounds DOWN to an integer.
The third thing performs a a division that rounds DOWN to an integer and then gives you the REMAINDER.
Now I know how to perform the first and the third operation, but not the second in LiveCode,
and as those operationsin Python are explained on "page 2" of that magazine (page 43).
.
Re: Getting Snakey
The second in Lc is 'div', as inrichmond62 wrote: ↑Sat Feb 15, 2020 5:24 pmNow I know how to perform the first and the third operation, but not the second in LiveCode,
The upper function changes what you specify (or not) to upper, handy if say, you chop a sentence in half, and want the first character recapitalized, you might use (psuedo code)richmond62 wrote: ↑Sat Feb 15, 2020 5:13 pmI have never seen any value in something that changes everything to upper case or the other way round.
Code: Select all
put upper(char 1 of line 12 of field "newSentence")

-
- Livecode Opensource Backer
- Posts: 5388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Getting Snakey
Thanks for div, I have never come across that before. 
