For var in (string1, string, string3)
For var in (string1, string, string3)
Such feature would be great in PB:
For os in ("Windows", "Linux", "MacOS")
Debug "PB is available for " + $os
Next
For os in ("Windows", "Linux", "MacOS")
Debug "PB is available for " + $os
Next
Re: For var in (string1, string, string3)
Code: Select all
NewMap OS.s()
OS("W") = "Windows"
OS("L") = "Linux"
OS("M") = "MacOS"
ForEach OS()
Debug "PB is available for " + OS()
Next
Re: For var in (string1, string, string3)
Something:
Code: Select all
DataSection:Data.s "Windows","Linux","MacOs":EndDataSection
For i = 0 To 2
Read.s s.s:Debug s
Next
Re: For var in (string1, string, string3)

Code: Select all
OS.s= "Windows,Linux,MacOs"
For i = 1 To CountString(OS, ",")+1
Debug StringField(OS, i, ",")
Next
Re: For var in (string1, string, string3)
There are many ways to do this.
LinkedList also maintains the order.
"For xyz in list" comes more from vb programming and requires an object list.
LinkedList also maintains the order.
"For xyz in list" comes more from vb programming and requires an object list.
Code: Select all
Macro AddElementValue(_List_, _Value_)
AddElement(_List_) : _List_ = _Value_
EndMacro
NewList OS.s()
AddElementValue(OS(), "Windows")
AddElementValue(OS(), "Linux")
AddElementValue(OS(), "MacOS")
ForEach OS()
Debug OS()
Next
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: For var in (string1, string, string3)
This would actually be quite nice, but we can't even declare arrays inline, I very highly doubt we're going to get convenience features like this 
Seems the PB team doesn't really care about syntax sugar and other things that would make code so much shorter. Not a position I personally agree with, but it's their project.

Seems the PB team doesn't really care about syntax sugar and other things that would make code so much shorter. Not a position I personally agree with, but it's their project.
Re: For var in (string1, string, string3)
Thanks everyone for the ideas.
I tend to think our suggestions could make a better Purebasic but I just read this thread so I now understand it will not happen.
I wonder why some people think everything should be free. Our meal is not free, neither our car is, so...
I tend to think our suggestions could make a better Purebasic but I just read this thread so I now understand it will not happen.
I wonder why some people think everything should be free. Our meal is not free, neither our car is, so...
Re: For var in (string1, string, string3)
IMHO, your pondering seems a little bit off the mark. There was a purchase and what was purchased is what is being expected and also what is being provided, nothing more and nothing less. To Fred and the PureBasic Team's credit, it is a genuine bargain and a treasure. I am not alone in advocating for showing appreciation, support, encouragement and so forth through generous contributions if one is able to. Others contribute to the value of PureBasic in other ways, including in the forums.elwood wrote: Thu Jan 04, 2024 12:11 am I wonder why some people think everything should be free. Our meal is not free, neither our car is, so...
Re: For var in (string1, string, string3)
1. Then you get a function by combining two logical operations, then what if you need only one logical operation? You will also waste time doing unnecessary operations (assigning an empty string when it is not required).Quin wrote: Mon Sep 11, 2023 12:52 am This would actually be quite nice, but we can't even declare arrays inline, I very highly doubt we're going to get convenience features like this
Seems the PB team doesn't really care about syntax sugar and other things that would make code so much shorter. Not a position I personally agree with, but it's their project.
2. If you create new functions every time, you will have to support them. Sources will become incompatible due to differences in functions. In this case, you can create a library of new functions created on the basis of PureBasic. For example, you can take functions from different programming languages and make their analogues by writing them in the PureBasic language, so that those people who came from another programming language do not feel the limitations and are immediately provided with greater opportunities.
For example, make a "slice" function from the "js" programming language
Code: Select all
var sString = "Hello";
sString = sString.slice(-4,-2)
WScript.Echo(sString);