Example Intro and HalPromIde24

Started by Frank Brübach, April 24, 2024, 09:33:10 PM

Previous topic - Next topic

Charles Pegge and 3 Guests are viewing this topic.

Frank Brübach

#15
Here are some Array examples

  ' -- arrays ----- 
  '
  '-- 1)
  '
  pim a(20) as pro = {2,4,6,8,10,12,14,16,18,20}

  a(20) = a(4) + a(6)
  printy a(20) '20

  '-- 2)
  '
  pim abc(100) as pro = {10,20,30,40,50,60,70,80,90,100}

  pindex 0
  printy abc[4] '50

  pindex 1
  printy abc[4] '40

  pindex 2
  printy abc[4] '30


  '-- 3)
  '
  pim tbo(100) as pro

  function abc(pro k,x)
    k*=2
    tbo[k]=x
  end function
 
  function abc(pro k) as pro
    k*=2
    return tbo[k]
  end function

  abc(5) = 2024
  printy abc(5) ' 2024


Frank Brübach

Here an interesting zstring example

'
' zstring example: reduces text with value -1
'
dim as zstring myzText = "I love Ironman"

dim i as long
for i  = 0 to len(myzText) - 1
   print "zero based try: " + myzText[i]
next

for i  = 1 to len(myzText)
   print "one based try: " + myzText[i]
next

print "fine"

Frank Brübach

#17
Hello all :) 👋

Made Last days for me an important Update of HalPromentBasic ...
I have changed some functions and Keywords.. its running all on a 64-bit machine now too

Halpromide Editor Shows at the start a Photo of the Stanley Kubrick film 2001 space odyssee because the hal Name belongs to this movie :)

The new Update 2 you can find in First Post at this Board

Next Update will expand and enhance Power with include Files and exe File producing

Thx, Frank





Frank Brübach

#18
Next calculation example, printy and p?, pstring,

' simple calc with printy and p?
' and two different functions with a friendly pbmain()
'

pim a,b,c,d,e as pro
pim s,st as pstring

a=30
b=40
c=50
d=a*b
e=d*c
s= "Hello Superman "+str(d)
st= "Hello Ironman "+str(e)
printy s
p? st

function pbmain() as long
pro a=2345
pstring s="I am thor "+a
'print s
return a
end function

print pbmain() '2345

function pbmain() as long
pro a=2345
pstring s="I am thor "+a
print s
'return a
end function

pbmain() ' I am Thor 2345

Frank Brübach

#19
[Code[
' francolinox/halProment-Basic
'-- new features: pys, p?, msgbox
'-- calc example 4
'
pim a,b,c,d,e as pro
pim z as pys
z=3
a=20
b=30
c=40
d=a*b
e=d*b
string s,st
pstring strx
strx = "powerbasic is a good basic program"
p? strx
s="Hello Batman " + str(d)
st="Hello Superman " + str(e)
print s
printy st
p? z
msgbox "hello"

Frank Brübach

#20
Class example 2

' class test addition, division
'
class statis

method plus() as double
method average() as double
dax(100) as double
dnx as long
end class

'----------------
methods of statis
'================

method plus() as double
dim i as integer
for i = 1 to this.dnx
method += this.dax(i)
next
end method

method average() as double
  method = this.plus / this.dnx 'division
  'method = this.plus + this.dnx 'addition
end method

end methods

'test
dim stx as statis

stx.dax => 2,4,6,8,10,12,14,16,18,20
stx.dnx = 8
print `plus: ` str(stx.plus) ` Average: ` str stx.average ' 72, 9 '' 72,80

Frank Brübach

Here is a simple c++ example I tried to Convert and my Idea was to translate much more for next Updates


int main {

int x = 5;
int y = 6;
int sum = x + y; '
'int mult = x * y;
'cout << sum;
cout sum;
'cout mult; ' 30 ok

return 0;
}
' result 11 ok

Frank Brübach

#22
1) Info: all new and old examples you can find in updated ZIP and rar folder in my Post #17

I couldnt changed the Text anymore in that Post #17 dont know why?

2) If you Like you can have a Look at
GitHub Frankolinox/HalProment-Basic for Download Access and Updates for next weeks and months

Frank Brübach

Next example Array redim ubound lbound (Convert from Powerbasic)


'
' -- array index redim ubound lbound example
' -- halPromentBasic, mai-2024,frank bruebach
'
pindex 1

dim MyArray(10) as integer '1 TO 10
dim i as integer

' Fill the array with some values
for i = LBOUND(MyArray) to UBOUND(MyArray)
    MyArray(i) = i * 10
next i

' Display the values in the array
for i = LBOUND(MyArray) to UBOUND(MyArray)
    printy "MyArray(" + str(i) + ") = " + str(MyArray(i))
next i

' Re-dimension the array to have 15 elements
redim integer MyArray(15) '1 to 15


' Fill the new array elements with some values
for i = UBOUND(MyArray) - 8 to UBOUND(MyArray) '- 4 ' -10
    MyArray(i) = i * 5
next i

' Display the values in the re-dimensioned array
for i = LBOUND(MyArray) to UBOUND(MyArray)
    printy "MyArray(" + str(i) + ") = " + str(MyArray(i))
next i

' ends


Frank Brübach

N-string example from freebasic Convert

' -- convert from freebasic, april-mai 2024
' -- simple example string / zstring halProment Basic
' -- Generatíng a string of n repeated characters
'
function generateRepeatedChar(character as string, n as Integer) as string
    dim result as pstring = ""
    dim i as integer

    for i = 1 to n
        result = result + character
    next

    return result
end function

' Example usage
dim repeatedString as pstring
repeatedString = generateRepeatedChar("*#", 5)

printy repeatedString ' Output: *#*#*#*#*#

' Create a zString
dim zString as pstring = ""
printy len(zString) ' Output: 0


'In this case, zString is an empty string,
'meaning it contains no characters.
'The length of zString is zero.

dim zString as pstring = "hey"
printy len(zString) ' Output: 3


Frank Brübach

Increasing number to a String Auto Convert

' -- when a number is assigned to a string, it autoconverts.
' -- halProment Basic
' --

pro flag=10
flag++
printy flag '11

' number to an increasing string
'1)
pstring s="200mona"
s=val(s)+1 '201
printy s 'result: "201"

'2)
pro k
k++
s=val(s)+k
printy s 'result: "202"

'3)
pstring m=" Mona"
pstring st="3000 " + m
st=val(st)+1
printy st + m 'result: 3001 Mona

'4)
pro km=100
km++
pstring m=" Mona"
pstring st="3000 " + m
st=val(st)+val(km)+1
printy st + m 'result: 3102 Mona

Zlatko Vid

Does your Hal support recursive functions ?

Frank Brübach

Yes Here WE Go


' -- recursive function, halProment

''-- a) Case (n = 0) : factorial(0) = 1
''-- b) Case (n > 0) : factorial(n) = n * factorial(n-1)
''-- b) this case calls the function itself: 'Return n * factorial(n - 1)

Function recursiveFactorial (ByVal n As Integer) As Integer
    If n = 0 Then                             '' end condition
        Return 1
    Else                                      '' recursion loop
        Return n * recursiveFactorial(n - 1)  '' recursive call
    End If
End Function

Printy recursiveFactorial(4) ' 24
p? recursiveFactorial(6) ' 720

Theo Gottwald

#28
Quote from: Frank Brübach on May 13, 2024, 05:51:20 PMHello all :) 👋

Made Last days for me an important Update of HalPromentBasic ...
I have changed some functions and Keywords.. its running all on a 64-bit machine now too

Halpromide Editor Shows at the start a Photo of the Stanley Kubrick film 2001 space odyssee because the hal Name belongs to this movie :)


**Can you Use Pictures from the Stanley Kubrick Film "2001: A Space Odyssey" in My Software? 🤔**

I have a question regarding the use of images and names from the classic Stanley Kubrick film "2001: A Space Odyssey" in my software. Specifically, I want to know if I can use single pictures from the movie and the name "HAL" without running into legal issues.

Here is the answer:
### Copyright on Images 📸

1. **Images from the Film**:
   - The film "2001: A Space Odyssey" is protected by copyright law. This includes any still images taken from the movie. You cannot legally use these images without permission from the copyright holder.
   - If you want to use images from the film, you would need to seek permission or license them from the rights holder, which is often the studio that produced the film (MGM or Warner Bros).

### Trademark on Names 🏷�

2. **Use of the Name "HAL"**:
   - The name "HAL" from the film is likely trademarked. Using it in your software could lead to trademark infringement issues, especially if it is used in a way that could cause confusion with the original character or brand.
   - To use the name "HAL" legally, you would need to check the trademark status and possibly seek permission from the trademark holder.

### Alternatives 💡

- **Public Domain or Licensed Images**: You could look for images that are in the public domain or available under a suitable license (such as Creative Commons) that explicitly allows commercial use.
- **Generic Names**: Instead of "HAL," you could create an original name for your software to avoid any trademark issues.

### Conclusion ✅

You should not use images from "2001: A Space Odyssey" or the name "HAL" in your software without proper licensing or permission. For a safe and legally sound approach, consider using public domain images and original names. If in doubt, consulting with a legal professional specialized in intellectual property law is recommended.

---

Hope this helps! 😊

Frank Brübach

Thanks for Info yes you are right I will Change it.. I am on Holiday for some days, frank